5 ms·
Operators can be useful in a setting where they are expected and natural - numbers, strings etc. Overriding them for dictionaries, streams custom classes has be
by seemslegit 7y ago
Operators can be useful in a setting where they are expected and natural - numbers, strings etc. Overriding them for dictionaries, streams custom classes has been shown to be a bad idea that makes the authors feel clever but results in code that is both less readable and harder to lookup - your IDE could bring up the right documentation when asked on dict.union but without some advanced syntax and type analysis will not be able to guess what | means for dicts and you'll get the documentation for bitwise or
- gowld 7y agoIt's weird to blame a language design for what's simply a bug in your IDE.
- seemslegit 7y agoIt's not a bug in a specific IDE - it's a language design feature that makes building support tools like IDEs harder. It also goes against Python's own zen of "explicit is better than implicit"