Created
October 10, 2012 14:51
-
-
Save nicolasfig/3866109 to your computer and use it in GitHub Desktop.
Patron singleton by Rafa.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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