why function got dictionary
Diez B. Roggisch
deets at nospam.web.de
Thu Apr 17 10:08:45 EDT 2008
AlFire 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?
because it is an object, and you can do e.g.
g.exposed = True
or similar stuff.
Diez
More information about the Python-list
mailing list