There's possibly a backport via `future` or `__future__`, but `with` is not 
listed as a simple statement type for Python2 
https://docs.python.org/2/reference/simple_stmts.html
________________________________________
From: Rawlin Peters <[email protected]>
Sent: Thursday, November 1, 2018 2:33 PM
To: [email protected]
Subject: Re: [EXTERNAL] Re: Python2 EoL

On Thu, Nov 1, 2018 at 11:51 AM Fieck, Brennan
<[email protected]> wrote:
> For an example of the first part of that, look no further than the __enter__ 
> and __exit__ methods I added a week or two ago in tosession.py - Python2 
> doesn't do anything special with these functions, but there's no restriction 
> placed on those names either. In Python3 that will allow them to be used in a 
> context-managed setting via the `with` statement.

Those methods aren't special only in Python3; they have the same
special meaning in Python2 that allows a class to be used as a context
manager via the `with` keyword.

Reply via email to