[Python-ideas] intput()
Andrew Barnert
abarnert at yahoo.com
Mon Jan 25 17:30:40 EST 2016
On Jan 25, 2016, at 14:25, Bar Harel <bzvi7919 at gmail.com> wrote:
>
> For the ducks among us. Simple, Clean, Efficient and Secure. The 4 S/C/E/S.
>
> def duckput():
> """Reads anything. 'Cause there's never too much ducktyping"""
> return eval(input()+";") # ; makes sure there is only one line.
Isn't that a guaranteed syntax error? Expressions can't include semicolons. Although I suppose that makes it even more secure, I think it would be more efficient to just `raise SyntaxError`.
>
>> On Mon, Jan 25, 2016 at 11:58 PM Ryan Gonzalez <rymg19 at gmail.com> wrote:
>> Also:
>>
>>
>> def linput():
>> 'Reads a list. Completely, 100% secure and bulletproof.'
>> return map(eval, input[1:-1].split(',')))
>>
>>
>> def ninput():
>> 'Reads None.'
>> assert input() == 'None'
>>
>> def strinput():
>> 'Reads a string. Also 100% secure.'
>> return eval("'" + input() + "'")
>>
>>> On January 25, 2016 2:04:08 PM CST, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>>
>>> Marcel O'Neil wrote:
>>>> def intput():
>>>> return int(input())
>>>
>>> And also
>>>
>>> def flintput():
>>> return float(input())
>>>
>>> Yabba-dabba-doo-ly,
>>> Greg
>>>
>>
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>> --
>> Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160125/7a80e498/attachment.html>
More information about the Python-ideas
mailing list