On 12 Apr 2005 03:09:48 -0700, "Michele Simionato" <[EMAIL PROTECTED]> wrote:
>Steven Bethard: >> It strikes me that I've never wanted or needed a singleton object. >> Would you mind sharing your use case? I'm just curious. > >"Singleton" is the most idiotic pattern ever. If you want an instance, >just >instantiate your class once. If a class should have only one instance, >you can just document it. What I find usuful is "memoize", which >contains "Singleton" as a special case. So I use memoize even >for singleton would-be, i.e. logfiles and databases connections >(memoizing the connections, if I try to open a database twice with the >same parameters, I am returned an instance of the already opened >database). > For most user application purposes, I agree, just use a single instance like a responsible adult ;-) But isn't bool supposed to be a singleton class/type ? >>> [bool(x) for x in 0, 0.0, [], {}, False] [False, False, False, False, False] >>> [id(bool(x)) for x in 0, 0.0, [], {}, False] [505014288, 505014288, 505014288, 505014288, 505014288] Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list