Re: "append_const" action

Greg Ward <[email protected]> Mon, 8 Nov 2004 20:33:20 -0500
Newsgroups gmane.comp.python.optik.user
Message-ID <[email protected]>
On 07 November 2004, Andrea 'fwyzard' Bocci said:
> To let the user specify what to optimize for, I use to syntaxes:
> program --target property1 --target property2 ... xmlfile
> or (for the most usefull)
> program --property1 --property2 ... xmlfile

Ahhh, I see.  Elegant solution.  I like it.  I occasionally do something
like this with mode-style options, using 'store_const' for each mode
(eg. --expert, --novice) -- this is a very natural extension of that
idiom.

OK, patch accepted -- checked in to the Subversion repository, r462.
Since I'm such a nice guy, I wrote the doc patch for you:

--- doc/reference.txt   (revision 453)
+++ doc/reference.txt   (working copy)
@@ -79,6 +79,8 @@
     store a false value
 ``append``
     append this option's argument to a list
+``append_const``
+    append a constant value to a list
 ``count``
     increment a counter by one
 ``callback``
@@ -223,6 +225,12 @@

     options.tracks.append(int("4"))

+* ``append_const`` [required: ``const``; relevant: ``dest``]
+
+  Like ``store_const``, but the value ``const`` is appended to ``dest``;
+  as with ``append``, ``dest`` defaults to None, and an an empty list is
+  automatically created the first time the option is encountered.
+
 * ``count`` [relevant: ``dest``]

   Increment the integer stored at ``dest``.  If no default value is


I don't think any more documentation than that is needed.

        Greg
-- 
Greg Ward <[email protected]>                         http://www.gerg.ca/
What the hell, go ahead and put all your eggs in one basket.


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click