pre-PEP generic objects

Nick Craig-Wood nick at craig-wood.com
Fri Dec 3 04:30:03 EST 2004


Peter Otten wrote:
> Functions written in Python have a __get__ attribute while builtin
> functions (implemented in C) don't. Python-coded functions therefore
> automatically act as descriptors while builtins are just another
> attribute.

Jp Calderone <exarkun at divmod.com> wrote:
> When the class object is created, the namespace is scanned for
> instances of <type 'function'>.  For those and only those, a
> descriptor is created which will produce bound and unbound methods.
> Instances of other types, such as <type 'int'> or <type
> 'builtin_function_or_method'>, are ignored, leading to the critical
> difference in this case:

I think I finally understand now - thank you to you both!

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list