hello
can you explain why python does not see difference between instance
method and class method, having the same name
example
>>> class toto(object):
... def f(self):
... print('instance method')
... @classmethod
... def f(cls):
... print('class method')
...
Peter Otten a écrit :
> Sylvain Ferriol wrote:
>
>
>>can you explain to me what happened:
>>
>>class toto(object):
>> eq = float.__eq__
>>
>>t = toto()
>>
>>getattr(t,'eq')
>>TypeError: descriptor '__eq__' fo
Fredrik Lundh a écrit :
> Sylvain Ferriol wrote:
>
>> can you explain to me what happened:
>>
>> class toto(object):
>>eq = float.__eq__
>>
>> t = toto()
>>
>> getattr(t,'eq')
>> TypeError: descriptor '__eq__'
hello
can you explain to me what happened:
class toto(object):
eq = float.__eq__
t = toto()
getattr(t,'eq')
TypeError: descriptor '__eq__' for 'float' objects doesn't apply to
'toto' object
--
http://mail.python.org/mailman/listinfo/python-list
> Michele Simionato already pointed you to `PEP 359`_. One of the reasons
> that I withdrew it was that people seemed to feel that you could get
> most of what you want now by defining appropriate metaclasses. In your
> case, for example, the appropriate metaclass and its usage might look
> l
Michele Simionato a écrit :
> Sylvain Ferriol wrote:
>
>>Michele Simionato a écrit :
>>
>>>See http://www.python.org/dev/peps/pep-0359 (already rejected by
>>>Guido).
>>>
>>
>>i do not understand the withdrawal note, what do "differe
Michele Simionato a écrit :
> Sylvain Ferriol wrote:
>
>>hello everybody,
>>
>>i want to talk with you about a question i have in mind and i do not
>>find a answer. it 's simple:
>>why do we not have a beatiful syntax for object definition as we have
new object syntax:
>> instance my_class:
>> __class__ = object
>> __metaclass__ = MyMetaClass
>>
thanks
Sylvain Ferriol
Ingénieur de recherche
Laboratoire TIMC/IMAG
http://www-timc.imag.fr/
--
http://mail.python.org/mailman/listinfo/python-list
hello
when i define __getattribute__ in a class, it is for the class instances
but if i want to have a __getattribute__ for class attributes
how can i do that ?
sylvain
--
http://mail.python.org/mailman/listinfo/python-list