On Apr 17, 4:06 pm, AlFire <[EMAIL PROTECTED]> wrote:

> Q: why function got dictionary? What it is used for?

As previously mentioned, a function has a __dict__ like (most) other
objects.

You can e.g. use it to create static variables:

int foobar()
{
   static int i = 0;
   return i++;
}

is roughly equivalent to:

def foobar():
   foobar.i += 1
   return foobar.i
foobar.i = 0







-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to