> But what sense would it make to force sets to expose > a __getitem__? Right now they inherit from dict and > thus do happen to expose it, but that's really an > implementation artefact showing through (and a good > example of why one might like to inherit without needing > to expose all of the superclass's interface, to tie this in > to another recent thread -- inheritance for implementation). > > Ideally, sets would expose __contains__, __iter__, __len__, > ways to add and remove elements, and perhaps (it's so in > Greg's implementation, and I didn't touch that) set ops such > as union, intersection &c. someset[anindex] is really a weird > thing to have... yet sets _are_ containers! I believe I recommended to Greg to make sets "have" a dict instead of "being" dicts, and I think he agreed. But I guess he never got to implementing that change. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4