On Fri, May 22, 2009 at 11:00 AM, Gökhan SEVER wrote:
> Because in this case serialc is an numpy array. Since loadtxt returns a
> numpy-array. Furthermore
>
> locals()['serialc_bin' + str(i+1)] creates a dictionary key (that's what I
> use the term "variable-like") serialc_bin1, serialc_bin2, ...
Top-posting corrected.
On Fri, 2009-05-22 at 10:00 -0500, Gökhan SEVER wrote:
> On Fri, May 22, 2009 at 9:43 AM, David Robinow
> wrote:
> On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER
> wrote:
> ...
> > serialc = np.loadtxt(sys.argv[1], skiprows=skiprows).T
>
Because in this case serialc is an numpy array. Since loadtxt returns a
numpy-array. Furthermore
locals()['serialc_bin' + str(i+1)] creates a dictionary key (that's what I
use the term "variable-like") serialc_bin1, serialc_bin2, ... not
serialc_bin[0] with indexes.
Gökhan
On Fri, May 22, 200
On Fri, May 22, 2009 at 10:27 AM, Gökhan SEVER wrote:
...
> 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.
I
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 t
En Tue, 19 May 2009 14:06:04 -0300, Gökhan SEVER
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
Thank you all for great explanation on this subject. Maybe a few sentences
from these conversations could be added to locals() documentation.
I will make double sure myself while using locals() to end up with valid
identifiers.
Gökhan
On Tue, May 19, 2009 at 1:06 AM, Steven D'Aprano <
ste...@re
Sorry for breaking threading, the original post is not being carried by
my ISP.
On Tue, 19 May 2009, Gökhan SEVER wrote:
> Hello,
>
> Could you please explain why locals() allow me to create variables that
> are not legal in Python syntax. Example: locals()['1abc'] = 55. Calling
> of 1abc resul
Gökhan SEVER wrote:
Hello,
Could you please explain why locals() allow me to create variables that
are not legal in Python syntax.
It doesn't.
Example: locals()['1abc'] = 55. Calling
of 1abc results with a syntax error.
Within a function, locals() is a persistemt dictionary copy of the lo
On Tue, 19 May 2009, Gökhan SEVER wrote:
> Hello,
>
> Could you please explain why locals() allow me to create variables that are
> not legal in Python syntax. Example: locals()['1abc'] = 55. Calling of 1abc
> results with a syntax error. Shouldn't it be better to raise an error
> during the variab
Hello,
Could you please explain why locals() allow me to create variables that are
not legal in Python syntax. Example: locals()['1abc'] = 55. Calling of 1abc
results with a syntax error. Shouldn't it be better to raise an error during
the variable creation time?
Thank you
Gökhan
--
http://mail
11 matches
Mail list logo