Re:Customizing class creation in Python
by lgas on Friday March 31, 2017 @12:04AM
(#14001097)
What problem would that cause? Wouldn't it only be a problem if you attempted to index into it, which you wouldn't do (on purpose) if you didn't think it was indexable? And if you did try to index into it thinking that it wasn't indexable, it would be a bug, which is the same as when it's indexable...
[ Parent
| on HN ]
Re:Customizing class creation in Python
by joshuamorton on Friday March 31, 2017 @12:27PM
(#14005383)
Exactly. You probably don't want this thing that is essentially a namespace to be indexable, but you index into it, which is a bug, but it quacks like a tuple, so your mistake propagates silently, which is a bad thing.
Its more permissive than one would expect. Although the bigger issue is what dragonne mentioned.