A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2011-February/108377.html below:

[Python-Dev] Why does TemporaryDirectory not wait for `__enter__`?

[Python-Dev] Why does TemporaryDirectory not wait for `__enter__`? [Python-Dev] Why does TemporaryDirectory not wait for `__enter__`?Robert Collins robertc at robertcollins.net
Sat Feb 26 19:48:29 CET 2011
On Sun, Feb 27, 2011 at 3:45 AM, cool-RR <cool-rr at cool-rr.com> wrote:

> I think that if someone calls `__enter__` directly, he takes the
> responsibility of calling `__exit__`, so we don't really have to help him
> with `__del__`.
> But other than that I understand the motivation for making it start on
> `__init__` rather then `__enter__`. I'll just make my own version of it that
> will work on `__enter__` instead.
> Thanks,
> Ram.

TempDir from 'fixtures' (http://pypi.python.org/pypi/fixtures) will do
what you want - __enter__ creates the directory, __exit__ deletes it.

Cheers,
Rob
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4