Re: folks, what's wrong with this?

2010-04-06 Thread Bruno Desthuilliers
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,

Re: folks, what's wrong with this?

2010-04-05 Thread Ani Sinha
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:

Re: folks, what's wrong with this?

2010-04-02 Thread Bruno Desthuilliers
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

Re: folks, what's wrong with this?

2010-04-02 Thread John Nagle
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

folks, what's wrong with this?

2010-04-01 Thread Ani
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)

Re: folks, what's wrong with this?

2010-04-01 Thread Robert Kern
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

Re: folks, what's wrong with this?

2010-04-01 Thread Ani
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):          

Re: folks, what's wrong with this?

2010-04-01 Thread Robert Kern
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):