Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-09 Thread Andreas Pfrengle
Kent Johnson wrote: > Andreas Pfrengle wrote: > >> # Accessing db (see http://www.djangoproject.com/documentation/db-api/): >> myobj = MyModel.objects.get() >> var = myobj.vector >> # vector is a Textfield, so var now contains a string, naming another >> db-

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-09 Thread Andreas Pfrengle
Bob Gailer wrote: > Andreas Pfrengle wrote: > >> [snip] > >> looks good if I'm happy with my values inside mydict and don't want >> to have sth. like x=5 in the end. But since 'x' is the name of a >> database field (I simplified it here fo

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Jordan Greenberg wrote: Andreas Pfrengle wrote: Bob Gailer wrote: Andreas Pfrengle wrote: Hello, I want to change the value of a variable whose name I don't know, but this name is stored as a string in another variable, like: x = 1 var = 'x' Now I want to c

Re: [Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Bob Gailer wrote: > Andreas Pfrengle wrote: > >> Hello, >> >> I want to change the value of a variable whose name I don't know, but >> this name is stored as a string in another variable, like: >> >> x = 1 >> var = 'x' >> >

[Tutor] Addressing a variable whose name is the value of a string

2007-04-08 Thread Andreas Pfrengle
Hello, I want to change the value of a variable whose name I don't know, but this name is stored as a string in another variable, like: x = 1 var = 'x' Now I want to change the value of x, but address it via var. I'm quite sure I've already seen a solution for this, but right now I don't get it