This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients gvanrossum, terry.reedy
Date 2015-05-22.18:01:12
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1432317672.61.0.139250100153.issue24234@psf.upfronthosting.co.za>
In-reply-to
Content
To my understanding, the presence of int.__int__ and float.__float__ are implementation issues.  I presume that float(ob) just calls ob.__float__ without slowing down for an isinstance(ob, float) check.  Ditto for int(ob).  The processing for complex(args) and bytes(args) are more complex and currently neither call an eponyous method. Would either be improved if it did?

One difference between int and complex, for instance, that might account for the internal implementation difference is that the second argument of int can only be used with a string first argument, while the second argument of complex cannot be used with a string first argument, and must support multiplication by 1j.  So int.__int__(self) does not allow a second parameter and can (and does) just return self.
History
Date User Action Args
2015-05-22 18:01:12terry.reedysetrecipients: + terry.reedy, gvanrossum
2015-05-22 18:01:12terry.reedysetmessageid: <1432317672.61.0.139250100153.issue24234@psf.upfronthosting.co.za>
2015-05-22 18:01:12terry.reedylinkissue24234 messages
2015-05-22 18:01:12terry.reedycreate