class method question

2006-10-25 Thread Sylvain Ferriol
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') ...

Re: is it a bug ?

2006-10-23 Thread Sylvain Ferriol
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

Re: is it a bug ?

2006-10-23 Thread Sylvain Ferriol
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__'

is it a bug ?

2006-10-23 Thread Sylvain Ferriol
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

Re: a new object definition

2006-09-04 Thread Sylvain Ferriol
> 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

Re: a new object definition

2006-09-01 Thread Sylvain Ferriol
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

Re: a new object definition

2006-09-01 Thread Sylvain Ferriol
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

a new object definition

2006-09-01 Thread Sylvain Ferriol
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

__getattribute__ for class object

2005-08-12 Thread Sylvain Ferriol
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