Properties/Decorators [WAS: Can I reference 1 instance of an object by more names ? rephrase]

Peter Otten __peter__ at web.de
Wed May 23 13:32:27 EDT 2007


Brian van den Broek wrote:

> I had the same sort of question as Wildemar and I set about
> investigating as any good pythonista would by typing help(apply) at
> the interactive prompt. That produced a help text that started:
> 
> Help on built-in function apply in module __builtin__:
> 
> But:
> 
>  >>> [x for x in dir('__builtin__') if 'apply' in x]
> []
> 
> ?  If apply is in the __builtin__ module, why doesn't
> dir('__builtin__') know about it?

The string "__builtin__" doesn't have an apply attribute; but the
__builtin__ module has:

>>> import __builtin__
>>> "apply" in dir(__builtin__)
True

Peter



More information about the Python-list mailing list