Tim Johnson wrote:
consider the following console session:
L = ['foo','bar']
locals()[L[0]] = L[1]
[...]
(2) Even if it did work, do you trust the source of the text? Taking
external data provided by arbitrary untrusted users and turning it into
variables is a good way to have your compute
* Hugo Arts [110103 17:12]:
> On Tue, Jan 4, 2011 at 2:06 AM, Alan Gauld wrote:
> >
> > "Tim Johnson" wrote
> >
> >> Now, Alan, do you know anything about PHP? If you do, can you
> >> comment on the PHP extract() function?
> >
> > I know enough basic PHP to read a page with code in it and get
On Tue, Jan 4, 2011 at 2:06 AM, Alan Gauld wrote:
>
> "Tim Johnson" wrote
>
>> Now, Alan, do you know anything about PHP? If you do, can you
>> comment on the PHP extract() function?
>
> I know enough basic PHP to read a page with code in it and get the general
> drift. I've never written a lin
"Tim Johnson" wrote
Now, Alan, do you know anything about PHP? If you do, can you
comment on the PHP extract() function?
I know enough basic PHP to read a page with code in it and
get the general drift. I've never written a line of it and have
learned enough about it that I don't want to
* Alan Gauld [110103 14:47]:
>
> "Tim Johnson" wrote
>
>> consider the following console session:
> L = ['foo','bar']
> locals()[L[0]] = L[1]
> foo
>> 'bar'
> locals()
>> {'__builtins__': , 'L': ['foo',
>> 'bar'], '__package__': None, '__name__': '__main__', 'foo': 'bar',
>> '__do
* Steven D'Aprano [110103 15:03]:
> Tim Johnson wrote:
>> I'm just have a little fun here, but I bet that comments will help
>> further elighten me on the subtleties of python.
>>
>> consider the following console session:
> L = ['foo','bar']
> locals()[L[0]] = L[1]
>
> This will not do wh
Tim Johnson wrote:
I'm just have a little fun here, but I bet that comments will help
further elighten me on the subtleties of python.
consider the following console session:
L = ['foo','bar']
locals()[L[0]] = L[1]
This will not do what you think it does. In general, local variables are
not
"Tim Johnson" wrote
consider the following console session:
L = ['foo','bar']
locals()[L[0]] = L[1]
foo
'bar'
locals()
{'__builtins__': , 'L': ['foo',
'bar'], '__package__': None, '__name__': '__main__', 'foo': 'bar',
'__doc__': None}
I could initialize variables in a local scope, or I co
I'm just have a little fun here, but I bet that comments will help
further elighten me on the subtleties of python.
consider the following console session:
>>> L = ['foo','bar']
>>> locals()[L[0]] = L[1]
>>> foo
'bar'
>>> 'foobar' in locals()
False
>>> 'foo' in locals()
True
>>> locals()
{'__built