[Python-ideas] intput()
Bar Harel
bzvi7919 at gmail.com
Mon Jan 25 17:36:09 EST 2016
Just decorate it with fuckit <https://github.com/ajalt/fuckitpy> and
everything will be alright. Make sure to follow the module's guideline
though: "This module is like violence: if it doesn't work, you just need
more of it."
On Tue, Jan 26, 2016 at 12:30 AM Andrew Barnert <abarnert at yahoo.com> wrote:
> 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/4a59c720/attachment-0001.html>
More information about the Python-ideas
mailing list