A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-May/044698.html below:

[Python-Dev] Passing compile(...,'exec') code to 'eval'

[Python-Dev] Passing compile(...,'exec') code to 'eval'Armin Rigo arigo at tunes.org
Thu May 6 04:51:16 EDT 2004
Hello Brett,

On Wed, May 05, 2004 at 11:23:16AM -0700, Brett C. wrote:
> Is this a bug, or are the docs wrong?  I am hoping it is the former 
> since if it is the latter my thesis just got a big caveat pasted into it 
> about how 'eval' can cause problems and invalidate the type inferencing 
> in irreparable ways.

There is another improbable way to bind variables with eval, with list
comprehensions:

>>> eval("[x for x in [3]]")
[3]
>>> x
3

If the goal is not security but type inference, I guess both this and the
compile() trick should be considered as outside any reasonable spec.


A bientot,

Armin.


More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4