Skip to content Skip to sidebar Skip to footer

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:


Post a Comment for "With Statement - Backport For Python 2.5"