This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Antony.Lee
Recipients Antony.Lee, eric.smith
Date 2014-09-11.09:24:07
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1410427448.25.0.907760158618.issue22387@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2014-09-11 09:24:08Antony.Leesetrecipients: + Antony.Lee, eric.smith
2014-09-11 09:24:08Antony.Leesetmessageid: <1410427448.25.0.907760158618.issue22387@psf.upfronthosting.co.za>
2014-09-11 09:24:08Antony.Leelinkissue22387 messages
2014-09-11 09:24:07Antony.Leecreate