On 2019-04-19, Stefan Ram <r...@zedat.fu-berlin.de> wrote: > Now consider the same in Python: > > def f(): > # ... > l = 22 # representing a length > # ... > l = 'abc'; # representing the left half of something > # ... > > A Python implementation does not catch the "error".
Obviously it is a deliberate design decision that Python does not require declaration of variables. > Has this ever been a problem for someone? It would be astonishing if it had not. > Are there means to deal with this? You would hope that pylint would catch it, but it appears it does not. mypy --strict will catch it if the reassignment has a different type. -- https://mail.python.org/mailman/listinfo/python-list