From: W. Trevor King Date: Sat, 14 Jul 2012 11:31:46 +0000 (-0400) Subject: Fix dead link to splittable_kwargs code by using the gitrepo template. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ed07bd46b954c8a7e106a18e56a8cb56f30d5287;p=blog.git Fix dead link to splittable_kwargs code by using the gitrepo template. Also convert to reference links (vs inline) for clarity in the splittable_kwargs post. --- diff --git a/posts/splittable_kwargs.mdwn b/posts/splittable_kwargs.mdwn index c5aebef..dc15552 100644 --- a/posts/splittable_kwargs.mdwn +++ b/posts/splittable_kwargs.mdwn @@ -1,5 +1,6 @@ [[!meta title="Splittable **kwargs"]] [[!meta date="2008-12-21 02:40:44"]] +[[!template id=gitrepo repo=splittable_kwargs]] Ah, it has been a while, but I am excited about a new python module I wrote so I shall post again ;). Actually, there has been a lot of @@ -8,25 +9,21 @@ the need to setup a bug-tracker to keep track of all the things going wrong with my cantilever calibration software :p. Since I'm using git for versioning, I naturally wanted a 'distributed bugtracker'. Luckily there are a number of nice ones out there. I've been using -[Bugs Everywhere](http://bugseverywhere.org/be/show/HomePage). My other -favorite is [Ditz](http://ditz.rubyforge.org/), but I like being able to -hack away on BE in my familiar Python. +[Bugs Everywhere][BE]. My other favorite is [Ditz][], but I like +being able to hack away on BE in my familiar Python. Besides helping keep track of my bugs, I've enjoyed hacking away at BE. In the process I've learned some cool tricks such as [Python -decorators](http://www.python.org/dev/peps/pep-0318/) (see [this -tutorial](http://adam.gomaa.us/blog/the-python-property-builtin/) for -some really neat examples) and [Bash -autocompletion](http://www.debian-administration.org/articles/317). +decorators][decorators] (see [this tutorial][AG] for some really neat +examples) and [Bash autocompletion][bash]. Meanwhile, the calibration code developed, and I was getting tired of keeping assorted keyword arguments default in sync (how many times do I have to repeat minFreq=500?). The way to avoid repeating yourself -in this situation is to use [`*args` or -`**kwargs`](http://docs.python.org/tutorial/controlflow.html#keyword-arguments) -(see [wxPython's endorsement](http://wiki.wxpython.org/wxPython Style Guide#line-42)). -I don't trust myself to keep my code in sync enough to use *args, so -lets focus on **kwargs. Consider the following example: +in this situation is to use [`*args` or `**kwargs`][kwargs] (see +[wxPython's endorsement][wxPython]). I don't trust myself to keep my +code in sync enough to use *args, so lets focus on **kwargs. Consider +the following example: >>> def A(a=1): ... return a @@ -41,10 +38,8 @@ lets focus on **kwargs. Consider the following example: TypeError: A() got an unexpected keyword argument 'b' Hmm, how to split the kwargs into those for `A` and those for `B`? So -I wrote the [splittable_kwargs -module](/~wking/code/#splittable_kwargs). See the docstrings -for some usage examples and more info. With my module the above -example becomes +I wrote the `splittable_kwargs`. See the docstrings for some usage +examples and more info. With my module the above example becomes >>> from splittable_kwargs import splittableKwargsFunction >>> @splittableKwargsFunction() @@ -64,5 +59,13 @@ In other news, my current side project is a MySQL-based, multi-user, archiving, command-line grade database. Down with web-forms ;). More information to come as the project progresses. +[BE]: http://bugseverywhere.org/ +[Ditz]: http://ditz.rubyforge.org/ +[decorators]: http://www.python.org/dev/peps/pep-0318/ +[AG]: http://adam.gomaa.us/blog/the-python-property-builtin/ +[bash]: http://www.debian-administration.org/articles/317 +[kwargs]: http://docs.python.org/tutorial/controlflow.html#keyword-arguments +[wxPython]: http://wiki.wxpython.org/wxPython Style Guide#line-42 + [[!tag tags/linux]] [[!tag tags/programming]]