On Jan 22, 2008 5:40 PM, Raymond Hettinger <python at rcn.com> wrote: > [Daniel Stutzbach] > > There are many places in the C implementation where a slot > > returns an int rather than a PyObject. There other replies > > in this thread seem to support altering the signature of the > > slot to return a PyObject. Is this setting a precedent that > > _all_ slots should return a PyObject? > > I hope not. [snip] > And, would we lose the nice relationship expressed by: > > for elem in container: > assert elem in container We've already lost this if anyone really wants to break it:: >>> class C(object): ... def __iter__(self): ... return iter(xrange(3)) ... def __contains__(self, item): ... return False ... >>> c = C() >>> for item in c: ... print item in c ... False False False Of course, anyone who decides to break their container classes in that way is asking for trouble. ;-) STeVe -- I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a tiny blip on the distant coast of sanity. --- Bucky Katt, Get Fuzzy
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