Re: setattr() oddness

2010-01-20 Thread M.-A. Lemburg
Dieter Maurer wrote: > Steven D'Aprano writes on 18 Jan 2010 > 06:47:59 GMT: >> On Mon, 18 Jan 2010 07:25:58 +0100, Dieter Maurer wrote: >> >>> Lie Ryan writes on Sat, 16 Jan 2010 19:37:29 +1100: On 01/16/10 10:10, Sean DiZazzo wrote: > Interesting. I can understand the "would take tim

Re: setattr() oddness

2010-01-19 Thread Dieter Maurer
Steven D'Aprano writes on 18 Jan 2010 06:47:59 GMT: > On Mon, 18 Jan 2010 07:25:58 +0100, Dieter Maurer wrote: > > > Lie Ryan writes on Sat, 16 Jan 2010 19:37:29 +1100: > >> On 01/16/10 10:10, Sean DiZazzo wrote: > >> > Interesting. I can understand the "would take time" argument, but I > >> >

Re: setattr() oddness

2010-01-17 Thread Steven D'Aprano
On Mon, 18 Jan 2010 07:25:58 +0100, Dieter Maurer wrote: > Lie Ryan writes on Sat, 16 Jan 2010 19:37:29 +1100: >> On 01/16/10 10:10, Sean DiZazzo wrote: >> > Interesting. I can understand the "would take time" argument, but I >> > don't see any legitimate use case for an attribute only accessibl

Re: setattr() oddness

2010-01-17 Thread Dieter Maurer
Lie Ryan writes on Sat, 16 Jan 2010 19:37:29 +1100: > On 01/16/10 10:10, Sean DiZazzo wrote: > > Interesting. I can understand the "would take time" argument, but I > > don't see any legitimate use case for an attribute only accessible via > > getattr(). Well, at least not a pythonic use case. >

Re: setattr() oddness

2010-01-16 Thread Lie Ryan
On 01/16/10 10:10, Sean DiZazzo wrote: > Interesting. I can understand the "would take time" argument, but I > don't see any legitimate use case for an attribute only accessible via > getattr(). Well, at least not a pythonic use case. mostly for people (ab)using attributes instead of dictionary.

Re: setattr() oddness

2010-01-15 Thread Terry Reedy
On 1/15/2010 6:10 PM, Sean DiZazzo wrote: On Jan 15, 2:22 pm, Terry Reedy wrote: On 1/15/2010 3:37 PM, Sean DiZazzo wrote: Should the following be legal? class TEST(object): pass ... t = TEST() setattr(t, "", "123") getattr(t, "") '123' Different people have different opinions as to w

Re: setattr() oddness

2010-01-15 Thread Sean DiZazzo
On Jan 15, 2:22 pm, Terry Reedy wrote: > On 1/15/2010 3:37 PM, Sean DiZazzo wrote: > > > Should the following be legal? > > class TEST(object): pass > > ... > t = TEST() > setattr(t, "", "123") > getattr(t, "") > > '123' > > Different people have different opinions as to whethe

Re: setattr() oddness

2010-01-15 Thread Steve Holden
Terry Reedy wrote: > On 1/15/2010 3:37 PM, Sean DiZazzo wrote: >> Should the following be legal? >> > class TEST(object): pass >> ... > t = TEST() > setattr(t, "", "123") > getattr(t, "") >> '123' > > Different people have different opinions as to whether setattr (and > correspondi

Re: setattr() oddness

2010-01-15 Thread Terry Reedy
On 1/15/2010 3:37 PM, Sean DiZazzo wrote: Should the following be legal? class TEST(object): pass ... t = TEST() setattr(t, "", "123") getattr(t, "") '123' Different people have different opinions as to whether setattr (and correspondingly getattr) should be strict or permissive as to whe