Skip to content

Instantly share code, notes, and snippets.

@mylons
Created April 24, 2012 20:04
Show Gist options
  • Save mylons/2483189 to your computer and use it in GitHub Desktop.
Save mylons/2483189 to your computer and use it in GitHub Desktop.
class Singleton:
__single = None
def __init__( self ):
if Singleton.__single:
raise Singleton.__single
#this line of code is never reached
#if __single already exists
Singleton.__single = self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment