String changing size on failure?

Ned Batchelder ned at nedbatchelder.com
Wed Nov 1 15:26:01 EDT 2017


 From David Beazley (https://twitter.com/dabeaz/status/925787482515533830):

     >>> a = 'n'
     >>> b = 'ñ'
     >>> sys.getsizeof(a)
    50
     >>> sys.getsizeof(b)
    74
     >>> float(b)
    Traceback (most recent call last):
       File "<stdin>", line 1, in <module>
    ValueError: could not convert string to float: 'ñ'
     >>> sys.getsizeof(b)
    77

Huh?

--Ned.




More information about the Python-list mailing list