Created
October 9, 2012 07:34
-
-
Save DanielSzoska/3857192 to your computer and use it in GitHub Desktop.
Auszug aus TextPatcher.__init__
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
with io.open(..) as f: | |
# do something | |
pass | |
# save the type of newlines | |
self.newlines = f.newlines |
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
with io.open(..) as f: | |
# do something | |
pass | |
# save the type of newlines | |
self.newlines = f.newlines |
Ist unnoetig. file.newlines ist die History der Datei, und die bleibt auch wenn die Datei geschlossen wird. Nur das Dateiobjekt muss noch existieren, und das tut's.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hallo Christian,
Ich würde vorsichtshalber das Konstrukt in
TextPatcher.__init__.modfified.py
verwenden, da ich immer davon ausgehe, daß das Objekt, was durch die with-Anweisung erstellt wird, nach dem Ende des with-Blocks nicht mehr zwingend da sein muß bzw. einen undefinierten Zustand hat. Wie siehst Du das?