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 eric.snow
Recipients Jurko.Gospodnetić, docs@python, eric.snow, eryksun, jcea, steven.daprano
Date 2014-05-13.01:03:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1399943018.5.0.638087447386.issue21415@psf.upfronthosting.co.za>
In-reply-to
Content
FYI, __new__() is a staticmethod to accommodate subclassing.  Several things that happen at instantiation-time (when __new__() is called), including memory allocation, are tied to the class that is passed in and may be different for subclasses.   For example:

class Spam(int):
    def __new__(cls, value):
        self = super().__new__(Spam, value)
        self._eggs = 10
        return self

Spam is passed in instead of int (as would happen if it were a classmethod), resulting in extra memory being allocated for _eggs (and for __dict__ among other things).
History
Date User Action Args
2014-05-13 01:03:38eric.snowsetrecipients: + eric.snow, jcea, steven.daprano, docs@python, Jurko.Gospodnetić, eryksun
2014-05-13 01:03:38eric.snowsetmessageid: <1399943018.5.0.638087447386.issue21415@psf.upfronthosting.co.za>
2014-05-13 01:03:38eric.snowlinkissue21415 messages
2014-05-13 01:03:38eric.snowcreate