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 neologix
Recipients eric.araujo, eric.smith, exarkun, giampaolo.rodola, meatballhat, milko.krachounov, neologix, olemis, pitrou, tarek, vstinner
Date 2011-12-23.12:54:19
SpamBayes Score 7.706003e-05
Marked as misclassified No
Message-id <CAH_1eM3tqdvuQw1dF4RfpKt_hUWVKTSvVVYPT5y5T87DzFob3A@mail.gmail.com>
In-reply-to <1324642101.3388.24.camel@localhost.localdomain>
Content
> Does it have to be a class? What would be the operations apart from
> write()?

Well, I thought that making it a file-like object could be useful:
that way, one could pass it to pickle.dump(), logging.StreamHandler or
any method expecting a file-like object, and would gain atomicity
(persistency) transparently, without refactoring.
My quick and dirty AtomicFile implementation reused the
_TemporaryFileWrapper attribute delagation trick:
"""
    def __getattr__(self, name):
        # Attribute lookups are delegated to the underlying file
        # and cached for non-numeric results
        # (i.e. methods are cached, closed and friends are not)
        file = self.__dict__['file']
        a = getattr(file, name)
        if not issubclass(type(a), type(0)):
            setattr(self, name, a)
        return a
"""

>> Still shutil?
>
> I think that's our best compromise.

OK.
I don't have a strong opinion about this, and you've got much more
experience than me, so I trust your judgement ;-)
History
Date User Action Args
2011-12-23 12:54:20neologixsetrecipients: + neologix, exarkun, pitrou, vstinner, eric.smith, giampaolo.rodola, tarek, eric.araujo, olemis, meatballhat, milko.krachounov
2011-12-23 12:54:19neologixlinkissue8604 messages
2011-12-23 12:54:19neologixcreate