Message170361
| Author |
brmzkw |
| Recipients |
brmzkw |
| Date |
2012年09月12日.09:00:35 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1347440457.56.0.780058714044.issue15929@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
argparse.add_argument replaces dashes with underscores. If an argument contains another non alphanum character, accessing to it will result to a syntax error.
#! /usr/bin/env python
import argparse
if __name__ == '__main__':
argParser = argparse.ArgumentParser()
argParser.add_argument('--foo+', action='store_true')
arguments = argParser.parse_args()
print 'getattr foo+: %s' % getattr(arguments, 'foo+') # ok
print arguments.foo+ # syntax error
The patch replaces every non alnum character with an underscore. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2012年09月12日 09:00:57 | brmzkw | set | recipients:
+ brmzkw |
| 2012年09月12日 09:00:57 | brmzkw | set | messageid: <1347440457.56.0.780058714044.issue15929@psf.upfronthosting.co.za> |
| 2012年09月12日 09:00:36 | brmzkw | link | issue15929 messages |
| 2012年09月12日 09:00:36 | brmzkw | create |
|