A RetroSearch Logo

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

Search Query:

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

[Python-Dev] Simple Switch statement

[Python-Dev] Simple Switch statementPhillip J. Eby pje at telecommunity.com
Mon Jun 26 02:46:46 CEST 2006
At 01:37 PM 6/25/2006 -0700, Raymond Hettinger wrote:

>>>No thanks.  That is its own can of worms.  The obvious solutions (like const
>>>declarations, macros, or a syntax to force compile-time expression 
>>>evaluation)
>>>are unlikely to sit well because they run afoul Python's deeply ingrained
>>>dynamism.
>>>
>>
>>I think perhaps you haven't been paying close attention to Fredrik's 
>>proposal.
>Yes, I have been.  That is one of the three options I listed above.
>Each has its own issues.
>
>The static() keyword works like Forth's brackets for forcing compile-time 
>evaluation.

No, it doesn't; this is why I suggested that you haven't been paying close 
attention.  The evaluation is at function definition time, not compile time.


>The issue for us is that unlike other Python expressions, there are 
>inconvenient limitiations on what can be expressed inside:
>
>   five = 5
>   eight = [8]
>   def f(x, six=6):
>          seven =  7
>          a = static(five + 4)    # this is legal
>          b = static(six + 4)      # this is illegal
>          c = static(seven + 4) # this is illegal
>          d = static(eight + [4]) # this is illegal

The last one is perfectly legal, and the middle two make no sense.

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