Skip to content

Instantly share code, notes, and snippets.

@Guilouf
Last active May 28, 2018 17:46
Show Gist options
  • Save Guilouf/61214b799b3278267eb566844fbb19d3 to your computer and use it in GitHub Desktop.
Save Guilouf/61214b799b3278267eb566844fbb19d3 to your computer and use it in GitHub Desktop.
Fourberie python
from multiprocessing import Pool
class Modudule:
def __init__(self, param):
self.param = param
print("modudu: ", self.param.bouboul, self.param.nom,
self.param.metoclass())
# via multiproc sur windows: false
class Param:
bouboul = False
def __init__(self, nom):
self.nom = nom
self.bouboul = self.bouboul # ca regle le problème
@classmethod
def metoclass(cls):
return "classmet", cls.bouboul
class Interface:
# class Param:
# bouboul = False
#
# def __init__(self, nom):
# self.nom = nom
# # self.bouboul = self.bouboul # ca regle le problème
# # les nested class ne marche pas en 3.4 apparement
def __init__(self):
self.Param = Param # si pas nested
self.Param.bouboul = True
inst = Modudule(self.Param("tre"))
pool = Pool()
pool.starmap(Modudule, [(self.Param("mul"),)])
if __name__ == "__main__":
Interface()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment