|
|
|
|
|
by kragen
2306 days ago
|
|
Python2 implicitly converts int to long and str to unicode: >>> 2**100
1267650600228229401496703205376L
>>> 'x' + u'y'
u'xy'
All Pythons implicitly convert int to float and int or float to
complex: >>> 1 + .5
1.5
>>> 2 * 3j
6j
Methods like list.extend now, in recent versions of Python (since
2.1), accept arbitrary iterables rather than just lists; it's more
debatable whether this is an “implicit type conversion” or not. >>> x = [3, 4]; x.extend((5, 6)); x
[3, 4, 5, 6]
|
|