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

Georg Brandl g.brandl at gmx.net
Thu Oct 13 09:31:35 CEST 2011


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.  (Ordinary decorators are bad enough, but I think it is
possible to grasp that the @foo stuff is some kind of "annotation".)

Georg




More information about the Python-ideas mailing list