[Python-Dev] argparse ugliness

Georg Brandl g.brandl at gmx.net
Sun Mar 7 10:10:08 CET 2010


Am 06.03.2010 03:28, schrieb Antoine Pitrou:
> Le Fri, 05 Mar 2010 13:51:15 -0500,
> Neal Becker <ndbecker2 at gmail.com> a écrit :
>> I generally enjoy argparse, but one thing I find rather
>> ugly and unpythonic.
>> 
>>     parser.add_argument ('--plot', action='store_true')
> 
> I would argue that a string is actually more Pythonic than
> integers or anonymous objects repurposed as magic constants.
> (I'm looking at things such as SEEK_SET and friends)

Me too.  In absence of a separate symbol type, Python itself
uses strings for this purpose (hence the intern()ing business).

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list