Re: "Variable variable name" or "variable lvalue"

2007-09-11 Thread Roberto Bonvallet
On Aug 15, 4:19 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > If you want to simplify things somewhat you can merge the two loops into > one: > > numbers = [12.5, 25, 12.5] > accu = Material(numbers[0]) > for x in numbers[1:]: > accu += Material(x) > period = Slab(accu) Bett

Re: "Variable variable name" or "variable lvalue"

2007-09-11 Thread inmmike
On Aug 19, 1:10 pm, Gary Herron <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Aug 15, 1:42 pm, mfglinux <[EMAIL PROTECTED]> wrote: > > >> Hello to everybody > > >> I would like to know how to declare in python a "variable name" that > >> it is in turn a variable > >> In bash shell I

Re: "Variable variable name" or "variable lvalue"

2007-08-19 Thread Steve Holden
Gary Herron wrote: > [EMAIL PROTECTED] wrote: >> On Aug 15, 1:42 pm, mfglinux <[EMAIL PROTECTED]> wrote: >> >>> Hello to everybody >>> >>> I would like to know how to declare in python a "variable name" that >>> it is in turn a variable >>> In bash shell I would wrote sthg like: >>> >>> for x in

Re: "Variable variable name" or "variable lvalue"

2007-08-19 Thread Gary Herron
[EMAIL PROTECTED] wrote: > On Aug 15, 1:42 pm, mfglinux <[EMAIL PROTECTED]> wrote: > >> Hello to everybody >> >> I would like to know how to declare in python a "variable name" that >> it is in turn a variable >> In bash shell I would wrote sthg like: >> >> for x in `seq 1 3` >> do >> M$i=Mate

Re: "Variable variable name" or "variable lvalue"

2007-08-19 Thread inmmike
On Aug 15, 1:42 pm, mfglinux <[EMAIL PROTECTED]> wrote: > Hello to everybody > > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > do

Re: "Variable variable name" or "variable lvalue"

2007-08-16 Thread mfglinux
The solution with the dictionary worked perfectlly well, my script is running and even produces data with sense!!! Thank you very much indeed to all of you answering. Cheers! -- http://mail.python.org/mailman/listinfo/python-list

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Dan Stromberg - Datallegro
On Wed, 15 Aug 2007 10:42:02 -0700, mfglinux wrote: > Hello to everybody > > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > don

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Francesco Guerrieri
On 8/15/07, mfglinux <[EMAIL PROTECTED]> wrote: > > > #Let's say x=3, then Period definition is > Period=Slab(Material1(12.5)+Material2(25)+Material3(12.5)) #Slab is a > python class > > I dont know how to automatize last piece of code for any x > Hello, you could use exec to create on the fly

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Peter Otten
mfglinux wrote: > Hello to everybody > > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > done In Python you would build a list

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Shawn Milochik
On 8/15/07, mfglinux <[EMAIL PROTECTED]> wrote: > Hello to everybody > > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > done > > W

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Larry Bates
mfglinux wrote: > Hello to everybody > > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > done > > Why I need this? Cause I have

Re: "Variable variable name" or "variable lvalue"

2007-08-15 Thread Marc 'BlackJack' Rintsch
On Wed, 15 Aug 2007 10:42:02 -0700, mfglinux wrote: > I would like to know how to declare in python a "variable name" that > it is in turn a variable > In bash shell I would wrote sthg like: > > for x in `seq 1 3` > do > M$i=Material(x) #Material is a python class > done You want a dictionary

"Variable variable name" or "variable lvalue"

2007-08-15 Thread mfglinux
Hello to everybody I would like to know how to declare in python a "variable name" that it is in turn a variable In bash shell I would wrote sthg like: for x in `seq 1 3` do M$i=Material(x) #Material is a python class done Why I need this? Cause I have a python module that obliges me to build

Re: Variable Variable

2005-03-20 Thread MikeyG
Premshree Pillai wrote: On Sat, 19 Mar 2005 04:35:47 -0500, Leif K-Brooks <[EMAIL PROTECTED]> wrote: Tanteauguri wrote: Hi List, is there in python a variable variable like in PHP ($$var)? What I want to do is something like that: pc=["a","b","c"] for i

Re: Variable Variable

2005-03-20 Thread Mike Gould
Premshree Pillai wrote: On Sat, 19 Mar 2005 04:35:47 -0500, Leif K-Brooks <[EMAIL PROTECTED]> wrote: Tanteauguri wrote: Hi List, is there in python a variable variable like in PHP ($$var)? What I want to do is something like that: pc=["a","b","c"] for i

Re: Variable Variable

2005-03-20 Thread Diez B. Roggisch
> > Personally I could live with that, but the diagram is a bit special > because of the restriction of the = operation. I do not know if PHP > supports this operational view by enabling iterations: $a, $$a, $$$a > ... ? It does. -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/

Re: Variable Variable

2005-03-20 Thread Kay Schluehr
> I'm going to make this explicit: the PHP idiom is a defect. > Yes, I know that's good style among top PHP practitioners, > but, from all I know, it's simply a bad habit. The advice to > use a dictionary is on target. I tried to like it the whole last hour ;-) I reconstructed the formal struct

Re: Variable Variable

2005-03-19 Thread Bruno Desthuilliers
Tanteauguri a écrit : Hi List, is there in python a variable variable like in PHP ($$var)? Hopefully, no. See other answers in that thread for pythonic idioms. -- http://mail.python.org/mailman/listinfo/python-list

Re: Variable Variable

2005-03-19 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Kay Schluehr <[EMAIL PROTECTED]> wrote: > >Tanteauguri wrote: >> Hi List, is there in python a variable variable like in PHP ($$var)? >> >> What I want to do is something like that: >> >> pc=["a","b&q

Re: Variable Variable

2005-03-19 Thread Kay Schluehr
Tanteauguri wrote: > Hi List, is there in python a variable variable like in PHP ($$var)? > > What I want to do is something like that: > > pc=["a","b","c"] > > for i in pc: > i = anyclass() > > a.shutdown() > b.update() > &g

Re: Variable Variable

2005-03-19 Thread Premshree Pillai
On Sat, 19 Mar 2005 04:35:47 -0500, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Tanteauguri wrote: > > Hi List, is there in python a variable variable like in PHP ($$var)? > > > > What I want to do is something like that: > > > > pc=["a",&

Re: Variable Variable

2005-03-19 Thread Leif K-Brooks
Tanteauguri wrote: Hi List, is there in python a variable variable like in PHP ($$var)? What I want to do is something like that: pc=["a","b","c"] for i in pc: i = anyclass() a.shutdown() b.update() Use a dictionary: stuff = {} pc = ['a', 'b',

Variable Variable

2005-03-19 Thread Tanteauguri
Hi List, is there in python a variable variable like in PHP ($$var)? What I want to do is something like that: pc=["a","b","c"] for i in pc: i = anyclass() a.shutdown() b.update() Any Ideas? Many Thanks, m -- http://mail.python.org/mailman/listinfo/python-list