3 ms·
> implicit conversion to long integers is still an example of weak typing No, it's an example of a properly defined integer type. Letting "integers" silently o
by mindslight 15y ago
> implicit conversion to long integers is still an example of weak typing
No, it's an example of a properly defined integer type. Letting "integers" silently overflow is weak typing. If you explicitly want wraparound arithmetic (by proving bounds for performance or wanting implicit modulo), then explicitly specify int16/int32/int64.
- mistercow 15y ago> Letting "integers" silently overflow is weak typing. "Weak typing" is a broad concept, but that's not one of the ideas that it covers. In any case, Python's conversion of integers to long integers is not transparent. It is an actual change to a different type, which is an example of weak typing.
- kstrauser 15y agoPython never converts an int to a long. Instead, it may return a long from the result of an operation on an int if that result wouldn't find in an int.