2013/5/14 Pietro Battiston <m...@pietrobattiston.it>: > Il giorno mar, 14/05/2013 alle 13.55 +0200, Andrea Francia ha scritto: >> >> >> 2013/5/14 Pietro Battiston <m...@pietrobattiston.it> >> Salve a tutti, >> >> sto usando con ragionevole soddisfazione del codice di questo >> tipo:¹ >> >> class TuDimmiCosaVuoiCheCiPensoIo(): >> def __init__(self, d): >> self._d = d >> self._pres = {} >> def __enter__(self): >> for key in self._d: >> if key in globals(): >> self._pres[key] = globals()[key] >> globals()[key] = self._d[key] >> def __exit__(self, type, value, traceback): >> for key in self._d: >> if key in self._pres and globals()[key] == >> self._d[key]: >> # Not changed - restore: >> globals()[key] = self._pres[key] >> >> a = "non ti sto mica salutando" >> >> print a >> with TuDimmiCosaVuoiCheCiPensoIo( {"a" : "ciao"} ): >> print a >> >> print a >> >> >> Ad occhio non sembra reentrant :/ >> > > > Non l'ho capita (e una googlata non mi aiuta)...
credo che si riferisse a questo: http://it.wikipedia.org/wiki/Codice_rientrante -- Gollum1 Tesssssoro, dov'é il mio tessssoro... _______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python