Newbie question about evaluating raw_input() responses

Chris Angelico rosuav at gmail.com
Thu May 23 03:20:19 EDT 2013


On Thu, May 23, 2013 at 5:11 PM, Terry Jan Reedy <tjreedy at udel.edu> wrote:
> On 5/23/2013 12:47 AM, Steven D'Aprano wrote:
>>
>> On Wed, 22 May 2013 22:31:04 +0000, Alister wrote:
>>
>>> Please write out 1000 time (without using any form of loop)
>>>
>>> "NEVER use input in python <3.0 it is EVIL"*
>
>
>> But all joking aside, eval is dangerous, yes, but it is not "evil".
>
>
> He put that label on *input*, not eval -- I presume for hiding dangerous
> eval.

Aside: Why was PHP's /e regexp option ever implemented? I can
understand evalling inputted text - that's how you write an
interactive interpreter. But why would you arbitrarily eval the result
of a regexp replacement? That seems... really weird. Like building a
gun with a "Reverse" switch that fires the bullet down the butt
instead of the barrel.

ChrisA



More information about the Python-list mailing list