3 ms·
I understand what you're trying to say, that type coercion makes a system 'weak', but your example is terrible. Python's type system uses interfaces, so string
by blasdel 16y ago
I understand what you're trying to say, that type coercion makes a system 'weak', but your example is terrible.
Python's type system uses interfaces, so strings are effectively also of type sequence, which is also of type boolean. Any object can just define __nonzero__() and be a boolean. That's all the bool() builtin does — it just tries to call __nonzero__() or __len__() — http://docs.python.org/library/stdtypes.html#truth-value-testing http://docs.python.org/library/stdtypes.html#truth-value-tes...