Re: Setting an attribute without calling __setattr__()

2008-04-29 Thread Joshua Kugler
animalMutha wrote: Consider reading the *second* paragraph about __setattr__ in section 3.4.2 of the Python Reference Manual. if you are simply going to answer rtfm - might as well kept it to yourself. For what it's worth, I (the original poster) am glad he answered that way. It showed me

Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread animalMutha
Hrvoje Niksic wrote: Hrvoje Niksic [EMAIL PROTECTED] writes: Joshua Kugler [EMAIL PROTECTED] writes: self.me = [] self.me = {} Use object.__setattr__(self, 'me') = [] and likewise for {}. Oops, that should of course be object.__setattr__(self, 'me', []).

Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread animalMutha
Consider reading the *second* paragraph about __setattr__ in section 3.4.2 of the Python Reference Manual. if you are simply going to answer rtfm - might as well kept it to yourself. -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Aahz
In article [EMAIL PROTECTED], Arnaud Delobelle [EMAIL PROTECTED] wrote: Joshua Kugler [EMAIL PROTECTED] writes: self.me = [] for v in obj: self.me.append(ObjectProxy(v)) Note that is could be spelt: self.me = map(ObjectProxy, v) It could also be

Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Marc 'BlackJack' Rintsch
On Sat, 26 Apr 2008 08:28:38 -0700, animalMutha wrote: Consider reading the *second* paragraph about __setattr__ in section 3.4.2 of the Python Reference Manual. if you are simply going to answer rtfm - might as well kept it to yourself. Yes, but if you are telling where exactly to find

Re: Setting an attribute without calling __setattr__()

2008-04-26 Thread Arnaud Delobelle
[EMAIL PROTECTED] (Aahz) writes: In article [EMAIL PROTECTED], Arnaud Delobelle [EMAIL PROTECTED] wrote: Joshua Kugler [EMAIL PROTECTED] writes: self.me = [] for v in obj: self.me.append(ObjectProxy(v)) Note that is could be spelt: self.me =

Setting an attribute without calling __setattr__()

2008-04-25 Thread Joshua Kugler
OK, I'm sure the answer is staring me right in the face--whether that answer be you can't do that or here's the really easy way--but I am stuck. I'm writing an object to proxy both lists (subscriptable iterables, really) and dicts. My init lookslike this: def __init__(self, obj=None):

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread Hrvoje Niksic
Joshua Kugler [EMAIL PROTECTED] writes: self.me = [] self.me = {} Use object.__setattr__(self, 'me') = [] and likewise for {}. -- http://mail.python.org/mailman/listinfo/python-list

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread John Machin
On Apr 26, 7:01 am, Joshua Kugler [EMAIL PROTECTED] wrote: OK, I'm sure the answer is staring me right in the face--whether that answer be you can't do that or here's the really easy way--but I am stuck. I'm writing an object to proxy both lists (subscriptable iterables, really) and dicts.

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread Hrvoje Niksic
Hrvoje Niksic [EMAIL PROTECTED] writes: Joshua Kugler [EMAIL PROTECTED] writes: self.me = [] self.me = {} Use object.__setattr__(self, 'me') = [] and likewise for {}. Oops, that should of course be object.__setattr__(self, 'me', []). --

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread Terry Reedy
Joshua Kugler [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] | OK, I'm sure the answer is staring me right in the face--whether that answer | be you can't do that or here's the really easy way--but I am stuck. I'm | writing an object to proxy both lists (subscriptable iterables,

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread Joshua Kugler
John Machin wrote: Is there a way to define self.me without it firing __setattr__? Consider reading the *second* paragraph about __setattr__ in section 3.4.2 of the Python Reference Manual. Like I said in my original post, it was probably staring me right in the face. I had read through a bit

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread George Sakkis
On Apr 25, 5:01 pm, Joshua Kugler [EMAIL PROTECTED] wrote: My init lookslike this: def __init__(self, obj=None): if type(obj).__name__ in 'list|tuple|set|frozenset': self.me = [] for v in obj: self.me.append(ObjectProxy(v)) elif

Re: Setting an attribute without calling __setattr__()

2008-04-25 Thread Arnaud Delobelle
Joshua Kugler [EMAIL PROTECTED] writes: [...] self.me = [] for v in obj: self.me.append(ObjectProxy(v)) Note that is could be spelt: self.me = map(ObjectProxy, v) -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list