On 8 December 2017 at 22:33, Erik Bray <erik.m.b...@gmail.com> wrote: > In other words, there are probably countless other cases in the stdlib > at all where it "doesn't make sense" to accept a float, but that > otherwise should accept objects that can be coerced to int without > having to manually wrap those objects with an int(o) call.
Updating these to call __index__ is fine (since that sets the expectation of a *lossless* conversion to an integer), but updating them to call __int__ generally isn't (since that conversion is allowed to be lossy, which may cause surprising behaviour). Indexing & slicing were the primary original use case for that approach (hence the method name), but it's also used for sequence repetition, and other operations. Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/