[Tutor] self

Shuying Wang shuying at gmail.com
Mon Feb 13 01:59:54 CET 2006


Hi,

I'm having problems understanding some code I came across:

class Singleton:
    __single = None
    def __init__( self ):
        if Singleton.__single:
            raise Singleton.__single
        Singleton.__single = self

What does passing self to Singleton.__single do?

--Shuying


More information about the Tutor mailing list