"Alexiev Nikolay" <al*****@activesolutions.bg> wrote in
news:ma*************************************@pytho n.org:
I need a simple implementation of singleton that will work on python
2.1. I havn't got idea how to creat without staticmethod. Can you give
me a solution ??? 10x in advance
The simplest singleton implementation, which works for any version of
Python is simply to use a module as your singleton instead of a class. You
can get hold of the singleton object from anywhere simply by importing it.
All functions defined in a module are effectively static methods on the
module object.
--
Duncan Booth
du****@rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?