Re: programmatically define a new variable on the fly

2007-08-13 Thread osiris43
> Anyway, I don´t see the point in this. Why don´t you just use > something like X['g'] instead? While it's not what the original author is intending, it seems to me that dynamically adding fields could be useful when something like a database schema changed frequently. For example, a row in a da

Re: programmatically define a new variable on the fly

2007-08-10 Thread Bart Ogryczak
On 10 ago, 00:11, Lee Sander <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm rea

Re: programmatically define a new variable on the fly

2007-08-10 Thread Bruno Desthuilliers
Lee Sander a écrit : > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm reading has > g 99 > on the first lin

Re: programmatically define a new variable on the fly

2007-08-09 Thread Roberto Bonvallet
On Aug 9, 6:11 pm, Lee Sander <[EMAIL PROTECTED]> wrote: > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. Use a dictionary. -- http://mail.python.org/

Re: programmatically define a new variable on the fly

2007-08-09 Thread Ian Clark
Lee Sander wrote: > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm reading has > g 99 > on the first line,

Re: programmatically define a new variable on the fly

2007-08-09 Thread Dustan
On Aug 9, 5:30 pm, Dustan <[EMAIL PROTECTED]> wrote: > given the > variables data (the dictionary), name (in your example, 'g') and > *size* (in your example, 99), you can add it data as shown: erm... make that: given the variables data (the dictionary), name (in your example, 'g') and size (in

Re: programmatically define a new variable on the fly

2007-08-09 Thread Dustan
On Aug 9, 5:11 pm, Lee Sander <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to define a new variable which is not predefined by me. > For example, > I want to create an array called "X%s" where "%s" is to be determined > based on the data I am processing. So, for example, if I the file > I'm re

programmatically define a new variable on the fly

2007-08-09 Thread Lee Sander
Hi, I would like to define a new variable which is not predefined by me. For example, I want to create an array called "X%s" where "%s" is to be determined based on the data I am processing. So, for example, if I the file I'm reading has g 99 on the first line, I want to create a new variable cal