Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
08.01.2011, 02:20, "Steven D'Aprano" : > On Fri, 07 Jan 2011 23:54:24 +0200, kost BebiX wrote: > >>  07.01.2011, 17:47, "Steven D'Aprano" >>  ;: >>>  On Fri, 07 Jan 2011 16:47:55 +0200, kost BebiX wrote:   Well, actually the code you showed doesn't work) >>>  Actually, it does. It just prints

Re: Rewriting __getattr__

2011-01-07 Thread Steven D'Aprano
On Fri, 07 Jan 2011 23:54:24 +0200, kost BebiX wrote: > 07.01.2011, 17:47, "Steven D'Aprano" > : >> On Fri, 07 Jan 2011 16:47:55 +0200, kost BebiX wrote: >> >>>  Well, actually the code you showed doesn't work) >> >> Actually, it does. It just prints a warning message as well. Look >> carefully: [

Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
07.01.2011, 17:47, "Steven D'Aprano" : > On Fri, 07 Jan 2011 16:47:55 +0200, kost BebiX wrote: > >>  Well, actually the code you showed doesn't work) > > Actually, it does. It just prints a warning message as well. Look > carefully: > >  class A(object): >>  .. def __init__(self): >>  ..   

Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
07.01.2011, 23:48, "Fuzzyman" : > On Jan 7, 3:18 pm, kost BebiX ; wrote: > >>  07.01.2011, 17:14, "Jean-Michel Pichavant" ;: >>>  kost BebiX wrote:  šSorry for top posting, didn't know about that) I'm quote new to posting to mailing lists.  šWell, actually the code you showed doesn'

Re: Rewriting __getattr__

2011-01-07 Thread Steven D'Aprano
On Fri, 07 Jan 2011 16:47:55 +0200, kost BebiX wrote: > Well, actually the code you showed doesn't work) Actually, it does. It just prints a warning message as well. Look carefully: class A(object): > .. def __init__(self): > .. self.d = {} > .. def __getattr__(self, key):

Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
07.01.2011, 17:14, "Jean-Michel Pichavant" : > kost BebiX wrote: > >>  Sorry for top posting, didn't know about that) I'm quote new to posting to >> mailing lists. >> >>  Well, actually the code you showed doesn't work) >  class A(object): >>  .. def __init__(self): >>  .. self.d =

Re: Rewriting __getattr__

2011-01-07 Thread Jean-Michel Pichavant
kost BebiX wrote: Sorry for top posting, didn't know about that) I'm quote new to posting to mailing lists. Well, actually the code you showed doesn't work) class A(object): .. def __init__(self): .. self.d = {} .. def __getattr__(self, key): .. try: ..

Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
07.01.2011, 16:22, "Jean-Michel Pichavant" : > kost BebiX wrote: > >>  You're absolutely right! Now try to do except Keyerror: raise >> AttributeError and it will also fail. But why? >> >>  07.01.2011, 15:45, "Jean-Michel Pichavant" ;: >>>  kost BebiX wrote:   Hi everyone!   I just saw a

Re: Rewriting __getattr__

2011-01-07 Thread Jean-Michel Pichavant
kost BebiX wrote: You're absolutely right! Now try to do except Keyerror: raise AttributeError and it will also fail. But why? 07.01.2011, 15:45, "Jean-Michel Pichavant" : kost BebiX wrote: Hi everyone! I just saw a bug (?) in bson.dbref:DBRef.__getattr__ Here's they're code:

Re: Rewriting __getattr__

2011-01-07 Thread kost BebiX
You're absolutely right! Now try to do except Keyerror: raise AttributeError and it will also fail. But why? 07.01.2011, 15:45, "Jean-Michel Pichavant" : > kost BebiX wrote: > >>  Hi everyone! >>  I just saw a bug (?) in bson.dbref:DBRef.__getattr__ >> >>  Here's they're code: >>  def __getat

Re: Rewriting __getattr__

2011-01-07 Thread Jean-Michel Pichavant
kost BebiX wrote: Hi everyone! I just saw a bug (?) in bson.dbref:DBRef.__getattr__ Here's they're code: def __getattr__(self, key): return self.__kwargs[key] And when you do copy.deepcopy on that object it will raise you KeyError. So here's a small piece of code that reproduces th

Rewriting __getattr__

2011-01-06 Thread kost BebiX
Hi everyone! I just saw a bug (?) in bson.dbref:DBRef.__getattr__ Here's they're code:     def __getattr__(self, key):     return self.__kwargs[key] And when you do copy.deepcopy on that object it will raise you KeyError. So here's a small piece of code that reproduces the problem: >>> clas