[issue4548] OptionParser : Weird comportement in args processing

2008-12-05 Thread Olivier Hervieu

New submission from Olivier Hervieu <[EMAIL PROTECTED]>:

Hi guys.. i found something strange on the behavior of OptionParser

If I have this sample code : 

import sys
from optparse import OptionParser

if __name__ == '__main__':
parser = OptionParser()
parser.add_option("-p", "--p", help="The P of python", default=None)
parser.add_option("-y", "--y", help="The Y of python", default=None)

(options,args) = parser.parse_args(sys.argv)
print options

and i execute :

myFile.py -p -y

the options.p will be -y and options.y will be None

worst.. if my user say :

myFile.py -p -y 'thon'

options.p will be -y and options.y will be None...

In all case I think that, if i do 

myFile.py -p -y 

options -p and options -y must be None

and if i want to put -y in options.p i say something like 

myFile.py -p "-y" so i can do after myFile.py -p "-y" -y "thon".

--
components: Extension Modules
messages: 77028
nosy: ohervieu
severity: normal
status: open
title: OptionParser : Weird comportement in args processing
type: behavior
versions: Python 2.5, Python 2.5.3

___
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4548>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18033] Example for Profile Module shows incorrect method

2013-07-03 Thread Olivier Hervieu

Olivier Hervieu added the comment:

Here is a fixed version for python2.7. Using StringIO instead of io module 
fixes the problem pointed by Ezio.
The print_stats method dumps the stats either on sys.stdout if `Stats` class is 
declared without a stream specification or in the given stream parameter (the 
name print_stats may be a bit misleading).

--
nosy: +ohe
Added file: http://bugs.python.org/file30760/issue18033_py2.patch

___
Python tracker 
<http://bugs.python.org/issue18033>
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com