[Python-ideas] Statement local functions and classes (aka PEP 3150 is dead, say 'Hi!' to PEP 403)

Antoine Pitrou solipsis at pitrou.net
Thu Oct 13 13:45:30 CEST 2011


On Thu, 13 Oct 2011 09:31:35 +0200
Georg Brandl <g.brandl at gmx.net> wrote:
> Am 13.10.2011 07:48, schrieb Nick Coghlan:
> 
> > Oh, I'll also note that the class variant gives you the full power of
> > PEP 3150 without any (especially) funky new namespace semantics:
> > 
> >     :x = property(@.get, @.set, @.delete)
> >     class scope:
> >         def get(self):
> >             return __class__.attr
> >         def set(self, val):
> >             __class__.attr = val
> >         def delete(self):
> >             del __class__.attr
> 
> Sorry, I don't think this looks like Python anymore.  Defining a class
> just to get at a throwaway namespace?  Using "@" as an identifier?
> Using ":" not as a suite marker?
> 
> This doesn't have any way for a casual reader to understand what's
> going on.

Same here. This is very cryptic to me.
(while e.g. Javascript anonymous functions are quite easy to read)

cheers

Antoine.





More information about the Python-ideas mailing list