Author flying sheep
Recipients arnau, bethard, eric.araujo, flying sheep
Date 2011-11-24.09:54:05
SpamBayes Score 1.77871e-06
Marked as misclassified No
Message-id <1322128446.78.0.599369995243.issue12776@psf.upfronthosting.co.za>
In-reply-to
Content
this is annoying:

i’m creating a reindentation script that reindents any valid python script. the user can specify if, and how many spaces he/she wants to use per indentation level. `0` or leaving the option out means “one tab per level”.

if the argument is given, appended code works as intended. but in the default case, the code fails for any of the two default values i tried.

i would expect that one of the default values works: either `0`, if the default value *is* converted via the `type` function, or `"\t"` if the default value bypasses it.

it seems that argparse applies the `type` function to the default instantly, and then to the argument (be it the already-converted default or a passed option).

this breaks `type` functions which aren’t reflexive for values from their result set, i.e.: `t(x) = y => t(y) = y` must be true for all `x` that the function can handle
History
Date User Action Args
2011-11-24 09:54:06flying sheepsetrecipients: + flying sheep, bethard, eric.araujo, arnau
2011-11-24 09:54:06flying sheepsetmessageid: <1322128446.78.0.599369995243.issue12776@psf.upfronthosting.co.za>
2011-11-24 09:54:06flying sheeplinkissue12776 messages
2011-11-24 09:54:05flying sheepcreate