Skip to content

Instantly share code, notes, and snippets.

@titouanc
Created February 24, 2013 10:55
Show Gist options
  • Select an option

  • Save titouanc/5023404 to your computer and use it in GitHub Desktop.

Select an option

Save titouanc/5023404 to your computer and use it in GitHub Desktop.
class ClasseA:
def __init__(self, prenom):
self.prenom = str(prenom)
def getPrenom(self):
return self.prenom
def hello(self):
print("Salut, je suis A "+self.getPrenom())
def helloHardstyle(self):
prenom = ClasseA.getPrenom(self)
print("Salut, je suis A "+prenom)
def fonctionA():
print("Je suis la fonction du fichier A")
import fichierA
a = fichierA.ClasseA('Alain')
a.hello()
a.helloHardstyle()
fichierA.fonctionA()
# === OU ===
from fichierA import ClasseA, fonctionA
a = ClasseA('Alain')
a.hello()
a.helloHardstyle()
fonctionA()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment