namespaces

Paolino paolo_veronelli at tiscali.it
Tue Aug 2 01:01:49 CEST 2005


George Sakkis wrote:
> Paolino wrote:
> 
> 
>>>>Even worse I get with methods and function namespaces.
>>>
>>>What is "even worse" about them?
>>>
>>
>>For my thinking, worse is to understand how they derive their pattern
>>from generic namespaces.
>>Methods seems not to have a writeble one,while functions as George and
>>Rob remembered have one which is not read only.Why?
> 
> 
> I'm not sure I can parse this successfully, let alone understand it.
> 

Functions' namespaces are writeble ,methods' not.

 >>> class C:
...   def m(self):pass
...   @classmethod
...   def cm(cls):pass
...   @staticmethod
...   def sm():pass
...
 >>> C.sm.set=None
 >>> C.cm.set=None
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
AttributeError: 'instancemethod' object has no attribute 'set'
##### instancemethod? C.cm is a classmethod

 >>> C.m.set=None
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
AttributeError: 'instancemethod' object has no attribute 'set'
#####
 >>>

Are these choices explained somewhere?

Isn't 'do more use of namespaces' a python zen-law?

Regards Paolino

		
___________________________________ 
Yahoo! Messenger: chiamate gratuite in tutto il mondo 
http://it.beta.messenger.yahoo.com



More information about the Python-list mailing list