On Dec 19, 2007 12:14 PM, Peter Otten <[EMAIL PROTECTED]> wrote:
> def __enter__(self):
> # ...
> return self
>
> should help.
That helps. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Dmitry Teslenko wrote:
> Hello!
> I've made some class that can be used with "with statement". It looks this
> way:
>
> class chdir_to_file( object ):
> ...
> def __enter__(self):
> ...
>
> def __exit__(self, type, val, tb):
> ...
> def get_chdir_to_file(file_path):
> return c
Hello!
I've made some class that can be used with "with statement". It looks this way:
class chdir_to_file( object ):
...
def __enter__(self):
...
def __exit__(self, type, val, tb):
...
def get_chdir_to_file(file_path):
return chdir_to_file(file_path)
...
Snippet with obj