Ani Sinha a écrit :
And now for the most import point: __getattr__ is only called as a
*last* resort. That is, after the attribute lookup mechanism will have
tried *and failed* to find the name in the instance's __dict__.
Thanks you all for all the suggestions and thoughts. So in other
words,
And now for the most import point: __getattr__ is only called as a
*last* resort. That is, after the attribute lookup mechanism will have
tried *and failed* to find the name in the instance's __dict__.
Thanks you all for all the suggestions and thoughts. So in other
words, this piece of code:
Ani a écrit :
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
Robert already addressed your problem, so I'll just comment on a couple
other points:
import copy
class BaseDummyObject(object):
def __init__(self):
pass
Bruno Desthuilliers wrote:
And now for the most import point: __getattr__ is only called as a
*last* resort. That is, after the attribute lookup mechanism will have
tried *and failed* to find the name in the instance's __dict__.
In general, getattr is for unusual situations only.
If you
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
pass
def __getattr__(self, item):
try:
return self.__dict__.__getitem__(item)
On 2010-04-01 13:56 PM, Ani wrote:
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
pass
def __getattr__(self, item):
try:
return
On Apr 1, 12:10 pm, Robert Kern robert.k...@gmail.com wrote:
On 2010-04-01 13:56 PM, Ani wrote:
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):
def __init__(self):
On 2010-04-01 16:52 PM, Ani wrote:
On Apr 1, 12:10 pm, Robert Kernrobert.k...@gmail.com wrote:
On 2010-04-01 13:56 PM, Ani wrote:
Hi All:
I am just a beginner in python. Can anyone please tell me what is
wrong with this piece of code?
import copy
class BaseDummyObject(object):