[Python-Dev] Simple Switch statementZ
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 = 
> > 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 + ) # 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 + ' is allowed in 'static', it certainly
wouldn't be allowed after 'switch' or 'case' since it's unhashable.
More information about the Python-Dev