Re: Get rid of recursive call __getattr__

2005-12-15 Thread bruno at modulix
Steve Holden wrote: > Peter Otten wrote: > >> Pelmen wrote: >> >> >> class Test: >>> >>> >>> def __getattr__(self, attr): >>>print attr >>> >>> def foo(x): >>>print x >>> >>> >> t = Test() >> print t >>> >>> >>> __str__ >>> >>> Traceback (most

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Peter Hansen
Pelmen wrote: class Test: > > def __getattr__(self, attr): > print attr > > def foo(x): > print x > > t = Test() print t > > __str__ > > Traceback (most recent call last): > File "", line 1, in -toplevel- > print t > TypeError: 'NoneType'

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Steve Holden
Peter Otten wrote: > Pelmen wrote: > > >class Test: >> >> def __getattr__(self, attr): >>print attr >> >> def foo(x): >>print x >> >> >t = Test() >print t >> >>__str__ >> >>Traceback (most recent call last): >> File "", line 1, in -toplevel-

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
thanks, now all clear -- http://mail.python.org/mailman/listinfo/python-list

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Peter Otten
Pelmen wrote: > >>> class Test: >   def __getattr__(self, attr): > print attr > >   def foo(x): > print x > > >>> t = Test() > >>> print t > __str__ > > Traceback (most recent call last): >   File "", line 1, in -toplevel- > print t > TypeError: 'None

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Steve Holden
Pelmen wrote: > How can I get rid of recursive call __getattr__ inside this method, if > i need to use method or property of the class? > The usual mistake here is to write a __getattr__() implementation that references an undefined self-relative name, which leads to a recursive

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
>>> class Test: def __getattr__(self, attr): print attr def foo(x): print x >>> t = Test() >>> print t __str__ Traceback (most recent call last): File "", line 1, in -toplevel- print t TypeError: 'NoneType' object is not callable what i have to

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
thanks, i found the problem -- http://mail.python.org/mailman/listinfo/python-list

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
as __repr__ for example? -- http://mail.python.org/mailman/listinfo/python-list

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
thanks, i understood my mistake i try to get attribute, that wasn't defined -- http://mail.python.org/mailman/listinfo/python-list

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
thanks, i should been read more closely -- http://mail.python.org/mailman/listinfo/python-list

Re: Get rid of recursive call __getattr__

2005-12-14 Thread Tim N. van der Leeuw
Pelmen wrote: > How can I get rid of recursive call __getattr__ inside this method, if > i need to use method or property of the class? Hi Pelmen, Having read the docs included with my Python distribution on __getattr__, I don't see yet how you will get recursive calls to the meth

Re: Get rid of recursive call __getattr__

2005-12-14 Thread bruno at modulix
Pelmen wrote: > How can I get rid of recursive call __getattr__ inside this method, if > i need to use method or property of the class? > Sorry, but I don't understand your question. Which recursive calls to __getattr__ ? __getattr__ is only called if a/ it's defined and b/ th

Get rid of recursive call __getattr__

2005-12-14 Thread Pelmen
How can I get rid of recursive call __getattr__ inside this method, if i need to use method or property of the class? -- http://mail.python.org/mailman/listinfo/python-list