On 23 Jun 2013 23:44, "Joshua Landau" <joshua.landau.ws@gmail.com> wrote:
On 23 June 2013 09:39, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
Joshua Landau wrote:
What about:
class Foo: bar = bar
That would be going too far, I think. I can't remember *ever* needing to write code like that in a class.
I have. Like, once, though.
Also, it's a somewhat dubious thing to write anyway, since it relies on name lookups in a class scope working dynamically. While they currently do in CPython, I wouldn't like to rely on that always remaining the case.
Is this not a defined behaviour? I wouldn't expect this to change before 4.0, and that's a different ballgame. Does it break in some other implementations?
It's defined behaviour. It's only function scopes which force assignment targets to be purely local. Cheers, Nick.
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas