On Thu, 17 Mar 2016 11:31 am, Chris Angelico wrote:

> Yes... in theory. But try rewriting my example to avoid decorator
> syntax. It won't work, because of this line:
> 
>     orig = globals()[cls.__name__]

That's a nasty, dirty piece of code, and I hope you are thoroughly ashamed
of having written it :-)

> It depends on the decorator being run before the name actually gets
> bound - which means the previous class is available to the decorator.
> You can't do that without decorator syntax, or messing around with
> multiple names.


I wouldn't want to rely on it working with decorator syntax either. Even if
it does now, I'm not sure that's a language guarantee.



-- 
Steven

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to