Author brett.cannon
Recipients ajaksu2, belopolsky, brett.cannon, doerwalter, eric.araujo, ggenellina, kawai, pitrou, rafe, vstinner
Date 2010-05-25.21:35:12
SpamBayes Score 0.00370523
Marked as misclassified No
Message-id <1274823314.68.0.978113071512.issue5094@psf.upfronthosting.co.za>
In-reply-to
Content
The singleton dislike from Antoine and me is that they are generally just not liked in the stdlib. None/True/False are special cases because they are syntax, so having ``None is None`` ever not work would just be weird. Otherwise singletons are unnecessary in Python. Just look through the stdlib and you will find very few singletons as they are generally considered bad. Having to write a custom __eq__ or __hash__ is just part of being explicit. And trying to make a factory function that always returns the same instance is not a solution either. I understand pytz might use them, but this is the stdlib, so we need to go with what we consider best practice for Python since it will lead to much more use than pytz gets.

Now if a simple FixedOffsetTimeZone class was added and we just pre-populated the datetime module with a utc attribute that contained an instance of that class set to the proper values for UTC, that I could support without controversy. That would get you your "singleton" by reliably using the same instance without having to try to hack in singleton support.
History
Date User Action Args
2010-05-25 21:35:14brett.cannonsetrecipients: + brett.cannon, doerwalter, belopolsky, ggenellina, pitrou, vstinner, ajaksu2, kawai, eric.araujo, rafe
2010-05-25 21:35:14brett.cannonsetmessageid: <1274823314.68.0.978113071512.issue5094@psf.upfronthosting.co.za>
2010-05-25 21:35:13brett.cannonlinkissue5094 messages
2010-05-25 21:35:12brett.cannoncreate