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/2006-December/070281.html below:

[Python-Dev] features i'd like [Python 3000?] ... #4: interpolated strings ala perl

[Python-Dev] features i'd like [Python 3000?] ... #4: interpolated strings ala perl [Python-Dev] features i'd like [Python 3000?] ... #4: interpolated strings ala perlJosiah Carlson jcarlson at uci.edu
Thu Dec 7 23:19:58 CET 2006
"Alexey Borzenkov" <snaury at gmail.com> wrote:
> It can even be simpler and more powerful:
> 
> class evallookup:
>    def __init__(self, nsg, nsl):
>       self.nsg = nsg
>       self.nsl = nsl
>    def __getitem__(self, name):
>       return eval(name, self.nsg, self.nsl)

Never use eval in any code where you don't have 100% control of the
content of what is being evaluated.  And even then, never use eval.

It doesn't make a difference in the earlier example, but I'm sure there
are ways of breaking the above in nasty ways.

 - Josiah

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