formations/python/formation/snippets/patrons.py
2013-01-08 11:15:45 +01:00

16 lines
255 B
Python

class MaClasse:
pass
class MaClasseDeux:
pass
binding = dict('un'=MaClasse, 'deux'=MaClasseDeux)
def ma_factory(key):
if key in binding:
return binding[key]()
else:
return NotFoundError("keskece?")