Fuzzyman wrote: > The operator module defines two functions : > > isMappingType > isSquenceType > > These protocols are loosely defined. Any object which has a > ``__getitem__`` method defined could support either protocol. These functions are actually testing for the presence of two different __getitem__ methods at the C level, one in the "mapping" substructure of the type object, and the other in the "sequence" substructure. This only works for types implemented in C which make use of this distinction. It's not much use for user-defined classes, where the presence of a __getitem__ method causes both of these slots to become populated. Having two different slots for __getitem__ seems to have been an ill-considered feature in the first place and would probably best be removed in 3.0. I wouldn't mind if these two functions went away. -- Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | Carpe post meridiam! | Christchurch, New Zealand | (I'm not a morning person.) | greg.ewing at canterbury.ac.nz +--------------------------------------+
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