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
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to