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
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
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.
>
&g
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
[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
--
http://mail.python.org/mailma
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?
>
> >>>
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,objec
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
--
its" 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.
--
http://mail.python.org/mailman/listinfo/python-list
e 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
--
http://mail.python.org/mailman/listinfo/python-list
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
11 matches
Mail list logo