Last active
May 28, 2018 17:46
-
-
Save Guilouf/61214b799b3278267eb566844fbb19d3 to your computer and use it in GitHub Desktop.
Fourberie python
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
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