why function got dictionary

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Thu Apr 17 10:33:52 EDT 2008


On 17 avr, 16:06, AlFire <spamgrinder.tryla... at gmail.com> wrote:
> Hi,
>
> I am seeking an explanation for following:
>
> Python 2.5.2 (r252:60911, Apr  8 2008, 21:49:41)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>  >>> def g(): return
> ...
>  >>> g.__dict__
> {}
>
> Q: why function got dictionary? What it is used for?

A: everything (or almost) in Python is an object. Including functions,
classes, modules etc.





More information about the Python-list mailing list