incolumepy.singleton-decorator 1.0.4
package incolumepy.singleton_decorator
License: BSD
Keywords: python incolumepy incolumepy.singleton_decorator

#



i

n

c

o

l

u

m

e

p

y

.

s

i

n

g

l

e

t

o

n

_

d

e

c

o

r

a

t

o

r







D

e

c

o

r

a

t

o

r



s

i

n

g

l

e

t

o

n



f

o

r



m

e

t

h

o

d

s

,



c

l

a

s

s

e

s



a

n

d



o

t

h

e

r

s



o

b

j

e

c

t

s



p

y

t

h

o

n







#

#



I

n

s

t

a

l

l

i

n

g




`

`

`




$



p

i

p



i

n

s

t

a

l

l



i

n

c

o

l

u

m

e

p

y

.

s

i

n

g

l

e

t

o

n

-

d

e

c

o

r

a

t

o

r




`

`

`







#

#



U

s

a

g

e




F

o

r



u

s

e



i

m

p

o

r

t



p

a

c

k

a

g

e



s

i

n

g

l

e

t

o

n

_

d

e

c

o

r

a

t

o

r




`

`

`




f

r

o

m



i

n

c

o

l

u

m

e

p

y

.

s

i

n

g

l

e

t

o

n

_

d

e

c

o

r

a

t

o

r



i

m

p

o

r

t



s

i

n

g

l

e

t

o

n




`

`

`







#

#



E

x

a

m

p

l

e




#

#

#



U

s

i

n

g



f

u

n

c

t

i

o

n

s




`

`

`








1



f

r

o

m



i

n

c

o

l

u

m

e

p

y

.

s

i

n

g

l

e

t

o

n

_

d

e

c

o

r

a

t

o

r



i

m

p

o

r

t



s

i

n

g

l

e

t

o

n








2



@

s

i

n

g

l

e

t

o

n








3



d

e

f



g

e

n

n

u

m

(

)

:








4











n



=



0








5











w

h

i

l

e



T

r

u

e

:








6



















y

i

e

l

d



n








7



















n



+

=



1








8










9



a



=



g

e

n

n

u

m

(

)






1

0



b



=



g

e

n

n

u

m

(

)






1

1



a

s

s

e

r

t



i

d

(

a

)



=

=



i

d

(

b

)

,



"

N

o

t



s

a

m

e



o

b

j

e

c

t

"






1

2



p

r

i

n

t

(

[

n

e

x

t

(

a

)



f

o

r



x



i

n



r

a

n

g

e

(

5

)

]

)






1

3



p

r

i

n

t

(

[

n

e

x

t

(

b

)



f

o

r



x



i

n



r

a

n

g

e

(

5

)

]

)







`

`

`







#

#

#



U

s

i

n

g



c

l

a

s

s

e

s




`

`

`








1



f

r

o

m



i

n

c

o

l

u

m

e

p

y

.

s

i

n

g

l

e

t

o

n

_

d

e

c

o

r

a

t

o

r



i

m

p

o

r

t



s

i

n

g

l

e

t

o

n






1

4



(

.

.

.

)






1

5








1

6








1

7



@

s

i

n

g

l

e

t

o

n






1

8



c

l

a

s

s



G

e

n

N

u

m

:






1

9











d

e

f



_

_

i

n

i

t

_

_

(

s

e

l

f

)

:






2

0



















s

e

l

f

.

n



=



0






2

1











d

e

f



_

_

i

t

e

r

_

_

(

)

:






2

2



















r

e

t

u

r

n



s

e

l

f






2

3











d

e

f



_

_

n

e

x

t

_

_

(

s

e

l

f

)

:






2

4



















s

e

l

f

.

n



+

=



1






2

5



















r

e

t

u

r

n



s

e

l

f

.

n






2

6








2

7








2

8



x



=



G

e

n

N

u

m

(

)






2

9



y



=



G

e

n

N

u

m

(

)






3

0



a

s

s

e

r

t



i

d

(

x

)



=

=



i

d

(

y

)

,



"

N

o

t



s

a

m

e



o

b

j

e

c

t

"






3

1



p

r

i

n

t

(

[

n

e

x

t

(

x

)



f

o

r



i



i

n



r

a

n

g

e

(

5

)

]

)






3

2



p

r

i

n

t

(

[

n

e

x

t

(

y

)



f

o

r



i



i

n



r

a

n

g

e

(

5

)

]

)




~




















































































`

`

`