Implementation of the global statement

Terry Reedy tjreedy at udel.edu
Thu Nov 28 20:20:57 EST 2002


"Bengt Richter" <bokr at oz.net> wrote in message
news:as5ugi$a48$0 at 216.39.172.122...
>  >>> def foo(x): print x
>  ...
>  >>> bar = foo.__get__('Hi via foo')
>  >>> bar()
>  Hi via foo

This is a new one for me:

>>> def f(): pass
...
>>> f.__get__
<method-wrapper object at 0x015197B0>
>>> f.__get__.__doc__
'descr.__get__(obj[, type]) -> value'

Seems to be a new, undocumented (?, not in indexes) method producing a
new, undocumented (?) internal type.  Not something to bank a product
on ;-)

Terry J. Reedy





More information about the Python-list mailing list