[Python-ideas] Short form for keyword arguments and dicts

Nick Coghlan ncoghlan at gmail.com
Mon Jun 24 01:33:21 CEST 2013


On 23 Jun 2013 23:44, "Joshua Landau" <joshua.landau.ws at gmail.com> wrote:
>
> On 23 June 2013 09:39, Greg Ewing <greg.ewing at 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 at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130624/310c5a0f/attachment.html>


More information about the Python-ideas mailing list