On 4/28/06, Greg Wilson <[EMAIL PROTECTED]> wrote:
> > If it is really limited to literals, then I'm not sure it matters; the
> > freeze should have the only reference.
> I'd like to say:
> x = 123 and x's value will never ever change
> Opens up lots of optimization possibilities, and makes code much safer.
So now were back to looking for a const marker.
Do you want to limit it to literals, or do you want to also say
(magic constant) x = y
meaning that x is bound do the current value of y? If so, do you want
to freeze the object itself to some level of recursion? "V will
always be this dict" isn't as useful as "V will always be the same
dict and that dict itself will never change again"
As to what the marker should be:
const x=123 # No worse than global, but ... that is faint praise.
@const # decorators can wrap assignments? Allows other
type specifiers
x = 123 # ... but a local-variable *slot* isn't currently
a full-fledged object
const(x) = 123 # variation of the decorator
-jJ
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com