A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2002-January/019497.html below:

[Python-Dev] PEP_215_ (string interpolation) alternative EvalDict

[Python-Dev] PEP_215_ (string interpolation) alternative EvalDict [Python-Dev] PEP_215_ (string interpolation) alternative EvalDictSteven Majewski sdm7g@Virginia.EDU
Tue, 15 Jan 2002 01:27:19 -0500 (EST)
On Mon, 14 Jan 2002, Paul Prescod wrote:

> Sure, for the same semantics. But EvalDict doesn't have the same
> semantics. Even if we ignore double interpolation there is the issue of
> code like this:
>
>
> >>> def double():
> ...    user_val = raw_input("Please enter a number:")
> ...    print "%(2*user_val)" % EvalDict
>
> >>> double()
> Please enter a number: 3 + (os.system("rm -rm *"))
>

But in EvalDict you have to explicitly pass it a namespace dict.
You just don't pass it one with access to os.system ( or most
other os calls. ) That's why I disliked an implicit namespace.

But your example suggests to me:

>>> input('?: ')
?: r'raw string'
'raw string'

>>> input('?: ')
?: u'unicode string'
u'unicode string'

>>> input('?: ')
?: $'$os.system("rm -rm *" )'

I guess you need to special case that out of the compiler also.
( Are there any others lurking about ? )


-- Steve




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