Message226758
The initial idea was to solve #14243 (NamedTemporaryFile would be more useful on Windows if you could close it without deleting) by adding a "closed" keyword argument to the constructor of a subclass, that would set "delete" to False and then close it, e.g.
class NTF(NamedTemporaryFile):
def __init__(self, *args, closed=False, **kwargs):
if closed: kwargs["delete"] = True
super().__init__(*args, **kwargs)
if closed: self.close()
Actually, there are some not-so-nice interactions with the context-manager protocol though, as the file cannot be reopened. So it's not clear that this is such a good idea.
Still, it somewhat confusing that a CamelCase object is not actually a type (especially when TemporaryDirectory is one). |
|
Date |
User |
Action |
Args |
2014-09-11 09:24:08 | Antony.Lee | set | recipients:
+ Antony.Lee, eric.smith |
2014-09-11 09:24:08 | Antony.Lee | set | messageid: <1410427448.25.0.907760158618.issue22387@psf.upfronthosting.co.za> |
2014-09-11 09:24:08 | Antony.Lee | link | issue22387 messages |
2014-09-11 09:24:07 | Antony.Lee | create | |
|