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/066537.html below:

[Python-Dev] Simple Switch statementZ

[Python-Dev] Simple Switch statementZ [Python-Dev] Simple Switch statementZKa-Ping Yee python-dev at zesty.ca
Mon Jun 26 01:12:07 CEST 2006
On Mon, 26 Jun 2006, Georg Brandl wrote:
> Raymond Hettinger wrote:
> >    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
>
> Why would the last line be illegal?

I believe Raymond is assuming it would be illegal because it's mutable.
I don't think much has been said about whether static(<EXPR>) should be
allowed to yield a mutable value, but if we did allow that, it might
open up an avenue to much confusion.  (I join the chorus of voices that
dislike the name 'static' for this feature.)

Whether or not 'eight + [4]' is allowed in 'static', it certainly
wouldn't be allowed after 'switch' or 'case' since it's unhashable.


-- ?!ng
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