[Python-ideas] intput()

Bar Harel bzvi7919 at gmail.com
Mon Jan 25 17:25:05 EST 2016


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.

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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160125/756a20a5/attachment.html>


More information about the Python-ideas mailing list