question about input() and/or raw_input()

Ethan Furman ethan at stoneleaf.us
Sun Jan 19 11:14:22 EST 2014


On 01/19/2014 12:26 AM, Rustom Mody wrote:
> On Sunday, January 19, 2014 10:29:58 AM UTC+5:30, Chris Angelico wrote:
>> On Sun, Jan 19, 2014 at 3:43 PM, Rustom Mody wrote:
>>>
>> As do these pieces of code:
>>
>>--> def quux1(x): return str(x+1)
>>--> def quux2(x): return hex(x+1)[2:]
>
> They do?
>
>--> quux1(2.3)
> '3.3'
>
>--> quux2(2.3)
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "<stdin>", line 1, in quux2
> TypeError: hex() argument can't be converted to hex

(Will be) fixed in 3.5 [1]  :)

--
~Ethan~

[1] Which is to say, both will raise an exception.



More information about the Python-list mailing list