Skip to content

Instantly share code, notes, and snippets.

@nicolasfig
Created October 10, 2012 14:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolasfig/3866109 to your computer and use it in GitHub Desktop.
Save nicolasfig/3866109 to your computer and use it in GitHub Desktop.
Patron singleton by Rafa.
class BecaEstudiante:
beca= None
cont= 0
@classmethod
def getBeca(cls,nombreBecado):
if cls.cont<5:
cls.cont+=1
cls.beca= BecaEstudiante()
print("Beca creada socio",nombreBecado,"!")
else:
print("No se creo la beca socio!")
return cls.beca
beca0= BecaEstudiante.getBeca("Nico")
beca1= BecaEstudiante.getBeca("Yisus")
beca2= BecaEstudiante.getBeca("Fuckencio")
beca3= BecaEstudiante.getBeca("Trollencio")
beca4= BecaEstudiante.getBeca("Fapencio")
beca5= BecaEstudiante.getBeca("Perrencio")
beca6= BecaEstudiante.getBeca("Putencia")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment