Re: [Python-Dev] [Python-checkins] peps: PEP 422 rewrite to present an idea that a) isn't crazy and b) it turns out

2012年6月06日 15:58:58 -0700

On Wed, Jun 6, 2012 at 6:07 PM, Eric Snow <[email protected]>wrote:
> On Wed, Jun 6, 2012 at 5:40 AM, nick.coghlan <[email protected]>
> wrote:
> > +
> > +Alternatives
> > +============
> > +
>
> Would it be worth also (briefly) rehashing why the class instance
> couldn't be created before the class body is executed*? It might seem
> like a viable alternative if you haven't looked at how classes get
> created.
>
Backwards compatibility is really the only reason. So it'll have to wait
till Python 4000. ;-)
(Still, that approach is in some ways actually better than the current
approach: you don't need a __prepare__, for example. Actually, if one were
designing a class creation protocol from scratch today, it would probably
be simplest to borrow the __enter__/__exit__ protocol, with __enter__()
returning the namespace to be used for the suite body, and __exit__()
returning a finished class... or something similar. Python-ideas stuff,
to be sure, but it could likely be made a whole lot simpler than the
current multitude of hooks, counter-hooks, and extended hooks.)
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to