4 ms·
Why then is len special? Should we also have builtins to add to a collection? If it is good design there, should others repeat it? For example, if a module aut
by rictic 15y ago
Why then is len special? Should we also have builtins to add to a collection?
If it is good design there, should others repeat it? For example, if a module author is defining a new protocol for a set of objects that anyone can implement should they provide functions that delegate to the methods in their protocol?
For myself I think that the python community can be counted on to be consistent without the need for this duplication and indirection.
- masklinn 15y ago> Should we also have builtins to add to a collection? No, because each collection type (mapping, sequence, set, ...) has very different addition semantics (and potentially arguments as well). On the other hand, there is a builtin to iterate over stuff.