[Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods (original) (raw)
Thomas Wouters thomas at xs4all.net
Fri Feb 17 17:41:11 CET 2006
- Previous message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Next message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, Feb 17, 2006 at 05:29:32PM +0100, Armin Rigo wrote:
> Where obj must be either an int or a long or another object that has the > index special method (but not self).
The "anything but not self" rule is not consistent with any other special method's behavior. IMHO we should just do the same as nonzero():
* nonzero(x) must return exactly a bool or an int.
Yes, very much so. And in case people worry that this makes wrapping objects harder: proxy objects (for instance) would do 'return operator.index(self._real)'.
-- Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
- Previous message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Next message: [Python-Dev] Please comment on PEP 357 -- adding nb_index slot to PyNumberMethods
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]