Popular recipes tagged "default_arguments"http://code.activestate.com/recipes/tags/default_arguments/2011-08-12T23:08:30-07:00ActiveState Code RecipesSmarter Default Arguments (Python) 2011-08-12T23:06:57-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577786-smarter-default-arguments/ <p style="color: grey"> Python recipe 577786 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/default_arguments/">default_arguments</a>, <a href="/recipes/tags/deferred/">deferred</a>, <a href="/recipes/tags/function/">function</a>, <a href="/recipes/tags/functions/">functions</a>). Revision 3. </p> <p>Improved handling of mutable and deferred default arguments. After the recipe you'll find an explanation of what that means.</p> <p>Works for 2.7 with minor tweaks (getfullargspec --> getargspec).</p> An Introduction to Deferred Default Arguments (Python) 2011-08-12T23:08:30-07:00Eric Snowhttp://code.activestate.com/recipes/users/4177816/http://code.activestate.com/recipes/577789-an-introduction-to-deferred-default-arguments/ <p style="color: grey"> Python recipe 577789 by <a href="/recipes/users/4177816/">Eric Snow</a> (<a href="/recipes/tags/default_arguments/">default_arguments</a>, <a href="/recipes/tags/deferred/">deferred</a>). Revision 2. </p> <p>If you have a function that calls another, passing through an argument, you likely want the default argument of your function to match that of the called function.</p> <p>Deferred default arguments is what I call the technique of using a sentinel for the default argument of your function and having the called function translate the sentinel into its own default argument.</p> <p>You'll find a more thorough treatment after the recipe.</p> Default arg special action (Python) 2010-04-14T19:52:33-07:00Ed Blakehttp://code.activestate.com/recipes/users/4173678/http://code.activestate.com/recipes/577194-default-arg-special-action/ <p style="color: grey"> Python recipe 577194 by <a href="/recipes/users/4173678/">Ed Blake</a> (<a href="/recipes/tags/default_arguments/">default_arguments</a>, <a href="/recipes/tags/identity/">identity</a>, <a href="/recipes/tags/oop/">oop</a>). </p> <p>A way to allow functions with 0, 1, and -1 arguments! For those times you want to differentiate a no value argument from a non-value argument.</p>