int vs. float

Chris Angelico rosuav at gmail.com
Sat Feb 11 22:34:11 EST 2017


On Sun, Feb 12, 2017 at 2:27 PM, Steve D'Aprano
<steve+python at pearwood.info> wrote:
>>
>> For example:
>>
>>    >>> ast.literal_eval("( 1.0, 3 )").__class__.__name__
>>    'tuple'
>
>
> In what way does returning a tuple match the requirement "return an int or a
> float or generate an error message"?

Easy. You just use a version of Python in which tuple is a subclass of int.

ChrisA



More information about the Python-list mailing list