Hello,

I use local() because I read a file which has many consecutive variables in
it. Like shown below: (I use numpy's txt reading function)

serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T
for i in range(20):
    locals()['serialc_bin' + str(i+1)] = serialc[i+4]

I don't know easier way than using locals() to construct variable-like
identities in my program.

Gökhan


On Fri, May 22, 2009 at 3:34 AM, Gabriel Genellina
<gagsl-...@yahoo.com.ar>wrote:

> En Tue, 19 May 2009 14:06:04 -0300, Gökhan SEVER <gokhanse...@gmail.com>
> escribió:
>
>  I will make double sure myself while using locals() to end up with valid
>> identifiers.
>>
>
> I would ask myself why I'm using locals() in the first place.
>
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to