On Tue, Jul 23, 2013 at 1:13 AM, Marc Tompkins <marc.tompk...@gmail.com>wrote:
> As an experiment, I added a couple of extra methods and attributes to the > Kronk class, but it didn't change anything - IDs still incremented by 40 > each time. eryksun will no doubt chime in to tell us exactly how object > IDs are derived in cPython, but I'll go out on a limb and say that they > have nothing to do with the size of the object; also that one would be very > silly to make a program rely in any way on predicting the next ID, since > external factors may throw off the calculations (as when I invoked your > original script from inside PyScripter). All that you can rely on is that > each unique object (i.e. doesn't pass an "is" comparison with any other > object) has a unique ID... and, for all I know, not even that. > A couple of clarifications I wish I'd made before hitting Send: I shouldn't have said that IDs are "derived" or "calculated"; they're "assigned", presumably on a first-come, first-served basis; when I said "external factors may throw off the calculations" I meant "may make your calculations non-congruent with reality".
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor