Are routine objects guaranteed mutable & with dictionary?

Alf P. Steinbach alfps at start.no
Fri Dec 4 05:58:15 EST 2009


* Marco Mariani:
> Alf P. Steinbach wrote:
> 
> 
>> Is this guaranteed to work in Python 3.x?
>>
>>
>>  >>> def foo(): pass
>> ....
>>  >>> foo.blah = 222
>>  >>> foo.blah
>> 222
>>  >>> _
> 
> I don't see why it shouldn't work.

For example,

   (42).blah = 666

The question is what guarantees or absence thereof the language specification, 
PEPs, intentions, whatever gives/has.


> BTW, it's a function, not a "routine"

Wikipedia is your friend, <url: http://en.wikipedia.org/wiki/Subroutine>.


Cheers & hth.,

- Alf



More information about the Python-list mailing list