"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
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