Strange metaclass behaviour

Michele Simionato michele.simionato at gmail.com
Fri Mar 24 08:18:20 EST 2006


Ziga Seilnacht wrote:
> >>> def in_class_statement2():
> ...     frame = sys._getframe(1)
> ...     return '__module__' in frame.f_locals and not \
> ...            '__module__' in frame.f_code.co_varnames

On second thought, to break this check is less easy than I expected, so
maybe it is reliable enough. BTW, if you are interested, you can check
the original code in zope.interface.advice.




More information about the Python-list mailing list