Re: variable variables

2010-06-18 Thread Jean-Michel Pichavant
someone wrote: On Jun 18, 12:49 pm, James Mills wrote: On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: I was looking for a "short way" to do it because I have a lot "some_object.attr.attr or some_object.other_attr.attr" in code. it looks like I cannot replace attr with just other vari

Re: variable variables

2010-06-18 Thread someone
On Jun 18, 2:37 pm, Bruno Desthuilliers wrote: > someone a crit : > > > On Jun 18, 2:05 pm, Bruno Desthuilliers > 42.desthuilli...@websiteburo.invalid> wrote: > (snip) > > >> Still has a "code smell" thing to me, but hard to say not knowing the > >> real code and context. > > > sorry, code is not

Re: variable variables

2010-06-18 Thread Bruno Desthuilliers
someone a écrit : On Jun 18, 2:05 pm, Bruno Desthuilliers wrote: (snip) Still has a "code smell" thing to me, but hard to say not knowing the real code and context. sorry, code is not about printing variables rather accessing, it's just example. Yeps, this I understood - hence the "but..

Re: variable variables

2010-06-18 Thread someone
On Jun 18, 2:05 pm, Bruno Desthuilliers wrote: > someone a crit : > > > > > > > On Jun 18, 12:49 pm, James Mills wrote: > >> On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: > >>> I was looking for a "short way" to do it because I have a lot > >>> "some_object.attr.attr or some_object.other_attr.

Re: variable variables

2010-06-18 Thread Bruno Desthuilliers
someone a écrit : On Jun 18, 12:49 pm, James Mills wrote: On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: I was looking for a "short way" to do it because I have a lot "some_object.attr.attr or some_object.other_attr.attr" in code. it looks like I cannot replace attr with just other variable

Re: variable variables

2010-06-18 Thread someone
On Jun 18, 12:49 pm, James Mills wrote: > On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: > > I was looking for a "short way" to do it because I have a lot > > "some_object.attr.attr or some_object.other_attr.attr" in code. it > > looks like I cannot replace attr with just other variable and must

Re: variable variables

2010-06-18 Thread James Mills
On Fri, Jun 18, 2010 at 8:31 PM, someone wrote: > I was looking for a "short way" to do it because I have a lot > "some_object.attr.attr or some_object.other_attr.attr" in code. it > looks like I cannot replace attr with just other variable and must > type some_object.other_attr.attr or your solut

Re: variable variables

2010-06-18 Thread Lie Ryan
On 06/18/10 20:31, someone wrote: > On Jun 18, 12:01 pm, "Gabriel Genellina" > wrote: >> En Fri, 18 Jun 2010 06:48:34 -0300, someone >> escribió: >> >>> is it possible to make first attr variable? >> >>> some_object.attr.attr >> >>> so instead of attr I could use self.foo which has value "attr"

Re: variable variables

2010-06-18 Thread someone
On Jun 18, 12:01 pm, "Gabriel Genellina" wrote: > En Fri, 18 Jun 2010 06:48:34 -0300, someone   > escribió: > > > is it possible to make first attr variable? > > > some_object.attr.attr > > > so instead of attr I could use self.foo which has value "attr" > > I think you're looking for > getattr:

Re: variable variables

2010-06-18 Thread Gabriel Genellina
En Fri, 18 Jun 2010 06:48:34 -0300, someone escribió: is it possible to make first attr variable? some_object.attr.attr so instead of attr I could use self.foo which has value "attr" I think you're looking for getattr: http://docs.python.org/library/functions.html#getattr name = "spam" g

variable variables

2010-06-18 Thread someone
Hello, is it possible to make first attr variable? some_object.attr.attr so instead of attr I could use self.foo which has value "attr" Thanks! -- http://mail.python.org/mailman/listinfo/python-list