Re: '_[1]' in .co_names using builtin compile() in Python 2.6

2013-11-28 Thread magnus.ly...@gmail.com
On Wednesday, November 27, 2013 9:09:32 PM UTC+1, Ned Batchelder wrote: > I hope you aren't trying to prevent malice this way: you cannot examine > a piece of Python code to prove that it's safe to execute. No worry. Whoever has access to modifying those configuration files can cause a mess in a

'_[1]' in .co_names using builtin compile() in Python 2.6

2013-11-27 Thread magnus.ly...@gmail.com
When I run e.g. compile('sin(5) * cos(6)', '', 'eval').co_names, I get ('sin', 'cos'), which is just what I expected. But when I have a list comprehension in the expression, I get a little surprise: >>> compile('[x*x for x in y]', '', 'eval').co_names ('_[1]', 'y', 'x') >>> This happens in Pyth

Importing package with zip-archives

2010-07-02 Thread magnus.ly...@gmail.com
I'd like to have the following structure of my Python code: I have a directory called 'mysystem'. In this directory, I have files 'comp1.zip' and 'comp2.zip' etc which are zipped archives with python packages and modules. I'd like to be able to use them like this in my code: import mysystem.comp

Python treats non-breaking space wrong?

2010-06-05 Thread magnus.ly...@gmail.com
It seems that Python treats non-breaking space (\xa0) as a normal whitespace character, e.g. when splitting a string. See below: >>> s='hello\xa0there' >>> s.split() ['hello', 'there'] Surely this is not intended behaviour? -- http://mail.python.org/mailman/listinfo/python-list