On 2/9/06, Alex Martelli <[EMAIL PROTECTED]> wrote: > Shouldn't that new API function (whatever its name) also be somehow > exposed for easy access from Python code? I realize new builtins are > unpopular, so a builtin 'asindex' might not be appropriate, but > perhaps operator.asindex might be. My main point is that I don't think > we want every Python-coded sequence to have to call x.__index__() > instead.
Very good point; this is why we have a PEP discussion phase. If it's x.__index__(), I think it ought to be operator.index(x). I'm not sure we need a builtin (also not sure we don't). I wonder if hasattr(x, "__index__") can be used as the litmus test for int-ness? (Then int and long should have one that returns self.) Travis, can you send me additional PEP updates as context or unified diffs vs. the PEP in SVN? (or against python.org/peps/pep-0357.txt if you don't want to download the entire PEP directory). -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com