A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-June/066395.html below:

[Python-Dev] Switch statement

[Python-Dev] Switch statement [Python-Dev] Switch statementGeorg Brandl g.brandl at gmx.net
Thu Jun 22 21:19:48 CEST 2006
M.-A. Lemburg wrote:

> A nice side-effect would be that could easily use the
> same approach to replace the often used default-argument-hack,
> e.g.
> 
> def fraction(x, int=int, float=float):
>     return float(x) - int(x)
> 
> This would then read:
> 
> def fraction(x):
>     const int, float
>     return float(x) - int(x)

There's a certain risk that the premature-optimization fraction will
plaster every function with const declarations, but they write
unreadable code anyway ;)

Aside from this, there's still another point: assume you have quite a
number of module-level string "constants" which you want to use in a switch.
You'd have to repeat all of their names in a "const" declaration in order
to use them this way.

Georg

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4