Re:I Want Off Mr. Golang's Wild Ride
by ric2b on Saturday February 29, 2020 @06:13PM
(#22453894)
Do you have an example of Python doing implicit type conversion?
[ Parent
| on HN ]
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]