Re: why function got dictionary

2008-04-20 Thread Gabriel Genellina
En Thu, 17 Apr 2008 11:06:08 -0300, AlFire [EMAIL PROTECTED] escribió: Q: why function got dictionary? What it is used for? If you want more details, see PEP 232 that introduced function writable attributes in Python 2.1: http://www.python.org/dev/peps/pep-0232/ -- Gabriel Genellina

Re: why function got dictionary

2008-04-19 Thread Christian Heimes
[EMAIL PROTECTED] schrieb: A: everything (or almost) in Python is an object. Including functions, classes, modules etc. Everything you can access from or through Python code must be an object. Every object has at least a type and a reference count. Christian --

Re: why function got dictionary

2008-04-19 Thread sturlamolden
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

Re: why function got dictionary

2008-04-19 Thread [EMAIL PROTECTED]
On 19 avr, 19:39, sturlamolden [EMAIL PROTECTED] wrote: 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

Re: why function got dictionary

2008-04-19 Thread sturlamolden
On Apr 19, 8:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: barfoo = foobar foobar = lambda x : x And boom. That's why I used the qualifier 'roughly equivalent' and not simply 'equivalent'. -- http://mail.python.org/mailman/listinfo/python-list

Re: why function got dictionary

2008-04-18 Thread Tim Roberts
AlFire [EMAIL PROTECTED] wrote: Diez B. Roggisch wrote: Q: why function got dictionary? What it is used for? because it is an object, and you can do e.g. you mean an object in the following sense? isinstance(g,object) True where could I read more about that? This is a very useful

why function got dictionary

2008-04-17 Thread AlFire
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

Re: why function got dictionary

2008-04-17 Thread Diez B. Roggisch
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

Re: why function got dictionary

2008-04-17 Thread [EMAIL PROTECTED]
.__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. -- http://mail.python.org/mailman/listinfo/python-list

Re: why function got dictionary

2008-04-17 Thread AlFire
Diez B. Roggisch wrote: Q: why function got dictionary? What it is used for? because it is an object, and you can do e.g. you mean an object in the following sense? isinstance(g,object) True where could I read more about that? Andy -- http://mail.python.org/mailman/listinfo/python

Re: why function got dictionary

2008-04-17 Thread Diez B. Roggisch
AlFire wrote: Diez B. Roggisch wrote: Q: why function got dictionary? What it is used for? because it is an object, and you can do e.g. you mean an object in the following sense? isinstance(g,object) True Yes. where could I read more about that? I don't know