Antony Lee added the comment:
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).
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue22387>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com