With Statement - Backport For Python 2.5
I'd like to use with statement in Python 2.5 in some production code. It was backported, should I expect any problems (e.g. with availability/compatibility on other machines/etc)?
Solution 1:
Yes, that statement is a no-operation in Python 2.6, so you can freely use it to make with
a keyword in your 2.5 code as well, without affecting your code's operation in 2.6. This is in fact the general design intention of "importing from the future" in Python!
Solution 2:
You can call this in Python 2.6 and 3.0/1 without problems (it's a no-op there).
Post a Comment for "With Statement - Backport For Python 2.5"