Popular recipes tagged "trick"http://code.activestate.com/recipes/tags/trick/2017-02-23T22:38:50-08:00ActiveState Code RecipesSimulating an unless (reverse if) statement in Python (Python) 2017-02-23T22:38:50-08:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/580758-simulating-an-unless-reverse-if-statement-in-pytho/ <p style="color: grey"> Python recipe 580758 by <a href="/recipes/users/4173351/">Vasudev Ram</a> (<a href="/recipes/tags/features/">features</a>, <a href="/recipes/tags/if/">if</a>, <a href="/recipes/tags/perl/">perl</a>, <a href="/recipes/tags/programming/">programming</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/trick/">trick</a>). </p> <p>This recipe shows how to simulate an unless statement (a sort of reverse if, like Perl has), in Python. It is just for fun and as an experiment, not meant for real use, because the effect of unless can easily be got by negating the sense of the condition in an if statement.</p> <p>More details and output here:</p> <p><a href="https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html" rel="nofollow">https://jugad2.blogspot.in/2017/02/perl-like-unless-reverse-if-feature-in.html</a></p> Poor man's mgrid (Python) 2009-01-21T15:37:13-08:00David Lamberthttp://code.activestate.com/recipes/users/4167420/http://code.activestate.com/recipes/576625-poor-mans-mgrid/ <p style="color: grey"> Python recipe 576625 by <a href="/recipes/users/4167420/">David Lambert</a> (<a href="/recipes/tags/index/">index</a>, <a href="/recipes/tags/index_tricks/">index_tricks</a>, <a href="/recipes/tags/method/">method</a>, <a href="/recipes/tags/mgrid/">mgrid</a>, <a href="/recipes/tags/numerical/">numerical</a>, <a href="/recipes/tags/numerical_methods/">numerical_methods</a>, <a href="/recipes/tags/numpy/">numpy</a>, <a href="/recipes/tags/scipy/">scipy</a>, <a href="/recipes/tags/trick/">trick</a>). </p> <p>Python 3 code. scipy.mgrid is a useful! This short implementation comes without installing numpy.</p>