How to stop statements within a Python with context from executing?
<p>I've some code like this:</p>

<pre><code>with SomeContext(args):
  &lt;statement1&gt;
  .
  .
  &lt;statementN&gt;
</code></pre>

<p>I want this code to behave like this:</p>

<pre><code>if some_condition(args):
  f1()
else:
  &lt;statement1&gt;
  .
  .
  &lt;statementN&gt;
</code></pre>

<p>Statements in else block will also need an access to args.</p>

<p>But I want to hide <code>f1</code> and <code>some_condition</code> from user of this abstraction, so using an if-else block is out of option. Also I don't want to force a constraint on the user to wrap all statements in a function. Is it possible to do some python magic in the <code>with</code> context that allows this? </p>
