Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
[snip] Could you make the program name unique just by combining it with the repository name in a single string? In my case I cannot. But there is a larger reason why I wouldn't do this: It would mean adding a special character that could not be included in the repository name, that is,

Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
I'm curious what these practical reasons are. One my smallest source files has 870 lines in it, my largest nearly 9000. If the problem is your editor, you should seriously consider switching. I think that the main reasons for doing so are as follows: git status provides much more

Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread Chris Angelico
On Thu, Apr 24, 2014 at 5:21 PM, tim.thel...@gmail.com wrote: [snip] Could you make the program name unique just by combining it with the repository name in a single string? In my case I cannot. But there is a larger reason why I wouldn't do this: It would mean adding a special

ANN: eGenix mxODBC Connect 2.0.5 - Python ODBC Database Interface

2014-04-24 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Connect Python ODBC Database Interface Version 2.0.5 mxODBC Connect is our commercially supported client-server product

Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread Steven D'Aprano
On Thu, 24 Apr 2014 00:21:18 -0700, tim.thelion wrote: [snip] Could you make the program name unique just by combining it with the repository name in a single string? In my case I cannot. But there is a larger reason why I wouldn't do this: It would mean adding a special character

ANN: Python Meeting Düsseldorf - 29.04.2014

2014-04-24 Thread eGenix Team: M.-A. Lemburg
[This announcement is in German since it targets a local user group meeting in Düsseldorf, Germany] ANKÜNDIGUNG Python Meeting Düsseldorf http://pyddf.de/ Ein Treffen

ANN: Wing IDE 5.0.6 released

2014-04-24 Thread Wingware
Hi, Wingware has released version 5.0.6 of Wing IDE, our cross-platform integrated development environment for the Python programming language. Wing IDE includes a professional quality code editor with vi, emacs, visual studio, and other key bindings, auto-completion, call tips,

Re: why my cur.executescript can not run?

2014-04-24 Thread Peter Otten
length power wrote: When cur.execute be used, i get right output. import sqlite3 con=sqlite3.connect(:memory:) cur=con.cursor() sql1=attach database 'g:\\workspace\\data\\Cinfo.sqlite' as Cinfo; sql2=select * from Cinfo.ipo; cur.execute(sql1) cur.execute(sql2) con.commit()

Re: Installing PyGame?

2014-04-24 Thread rohit782192
On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote: Perhaps this isn't the right place to post this, but it's the only place I could find. I asked yesterday or the day before about Python Game Development, and have found a few tutorials on PyGame. Now I have a bigger problem:

Re: Moving to an OOP model from an classically imperitive one

2014-04-24 Thread tim . thelion
A reasonable compromise might be to keep the *data* assocated with a SubuserProgram in a class, maybe together with a few methods that are tightly coupled to it, but have the major pieces of functionality such as install() implemented by separate functions that operate *on* the class,

Re: Installing PyGame?

2014-04-24 Thread Terry Reedy
On 4/24/2014 11:32 AM, rohit782...@gmail.com wrote: When you post, please do more than just quote. If you are relaying a private email, please say so. On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote: I did not see the original post, if indeed there was a public one. [snip

Re: Installing PyGame?

2014-04-24 Thread Steven D'Aprano
On Thu, 24 Apr 2014 15:15:09 -0400, Terry Reedy wrote: On 4/24/2014 11:32 AM, rohit782...@gmail.com wrote: When you post, please do more than just quote. If you are relaying a private email, please say so. On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote: I did not see the

Re: Installing PyGame?

2014-04-24 Thread Gregory Ewing
rohit782...@gmail.com wrote: On Saturday, June 8, 2013 9:37:44 PM UTC+5:30, Eam onn wrote: Now I have a bigger problem: HOW THE HECK DO I INSTALL PYGAME!?!?! System Details: I've tried using MacPorts, Fink, the Mac DMG, source installing, installing NumPY, just about every way possible. My

Re: Installing PyGame?

2014-04-24 Thread Gregory Ewing
Terry Reedy wrote: Idle depends on tkinter. Tkinter depends on having a tcl/tk that works, at least for tkinter. The following page has essential info about getting the right tcl/tk installed. https://www.python.org/download/mac/tcltk Also keep in mind that you don't *have* to use IDLE at

Re: Installing PyGame?

2014-04-24 Thread Ned Deily
In article brtt0jf10j...@mid.individual.net, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: My advice would be to steer clear of things like Fink and MacPorts and do things the native MacOSX way wherever possible. That means using a framework installation of Python and framework versions of

Re: retrieve source code from code object as returned by compile()

2014-04-24 Thread Justin Ezequiel
On Thursday, April 24, 2014 1:53:38 PM UTC+8, Gregory Ewing wrote: Alternatively you could create a .pyc file out of the code object and then use Easy Python Decompiler on that. The following snippet of code should do that: (Taken from:

Re: Installing PyGame?

2014-04-24 Thread Ryan Hiebert
On Thu, Apr 24, 2014 at 9:38 PM, Ned Deily n...@acm.org wrote: In article brtt0jf10j...@mid.individual.net, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: My advice would be to steer clear of things like Fink and MacPorts and do things the native MacOSX way wherever possible. That means

[issue21342] multiprocessing RLock and Lock raise incorrect exceptions when releasing an unlocked lock.

2014-04-24 Thread Steinn Steinsen
New submission from Steinn Steinsen: In the documentation of multiprocessing the locks, RLock and Lock, are said to be clones of their respective threading synchronization primitives. There is an inconsistency in what exceptions are raised when an unlocked lock is released. According to the

[issue16104] Compileall script: add option to use multiple cores

2014-04-24 Thread Claudiu.Popa
Claudiu.Popa added the comment: Added a new version of the patch which incorporates suggestions made by Jim. Thanks for the review! -- Added file: http://bugs.python.org/file35018/issue16104_8.patch ___ Python tracker rep...@bugs.python.org

[issue21343] os.path.relpath returns inconsistent types

2014-04-24 Thread Matt Bachmann
New submission from Matt Bachmann: I noticed an issue passing in unicode to os.path.relpath. Specifically that in some cases when passing in unicode I would get back unicode and others I would get back a string. Below I demonstrate the issue. I also attached a patch. Is this an issue or am I

[issue17552] socket.sendfile()

2014-04-24 Thread Charles-François Natali
Charles-François Natali added the comment: A useful parameter instead would be to support sending only part of the file, so adding a count argument. Have you read my patch? This is already provided by the offset parameter. Of course I read your patch ;-) I mean I'd like a parameter for the

[issue17552] socket.sendfile()

2014-04-24 Thread akira
akira added the comment: use_fallback parameter is mostly a debugging tool. If it helps to avoid the indecision; I would side with neologix' remarks and also suggest to drop the use_fallback parameter. It seems the patch assumes *offset == nbytes_sent* that is false in general e.g., if offset

[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch
Milan Oberkirch added the comment: Updated the last patch according to the review comments at https://bugs.python.org/review/20098/. -- Added file: http://bugs.python.org/file35020/mangle_from_20140424.patch ___ Python tracker rep...@bugs.python.org

[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch
Changes by Milan Oberkirch milan...@oberkirch.org: Added file: http://bugs.python.org/file35021/mangle_from_20140424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20098 ___

[issue20098] email policy needs a mangle_from setting

2014-04-24 Thread Milan Oberkirch
Changes by Milan Oberkirch milan...@oberkirch.org: Removed file: http://bugs.python.org/file35020/mangle_from_20140424.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20098 ___

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
New submission from Russell Ballestrini: The current implementation of difflib's get_close_matches() function computes computationally complex scores (ratios) but then tosses them out without giving the end-user the chance to have at them. This patch adds an optional scores boolean argument

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Changes by Russell Ballestrini russell.ballestr...@gmail.com: Removed file: http://bugs.python.org/file35022/difflib.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344 ___

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Changes by Russell Ballestrini russell.ballestr...@gmail.com: -- keywords: +patch Added file: http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch ___ Python tracker rep...@bugs.python.org

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa
Claudiu.Popa added the comment: It would be easier to review your patch if you'll upload it as a proper patch. Usually for these cases (modifying the return by passing a specific argument) it's best to provide a new function with this functionality, by having get_close_matches and

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa
Claudiu.Popa added the comment: Ah, nevermind my first comment. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344 ___ ___ Python-bugs-list

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Russell Ballestrini added the comment: Claudiu.Popa, Yes, that was my first idea on how to tackle this issue. I will create another proper patch that prepares two separate functions: * get_close_matches * get_scored_close_matches Where each are basically wrapper / API functions around a

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Russell Ballestrini added the comment: New function in difflib: get_scored_matches() This function acts just like the existing get_close_matches() function however instead of returning a list of words, it returns a list of tuples (score, word) pairs. This gives the end-user the ability to

[issue17552] socket.sendfile()

2014-04-24 Thread Giampaolo Rodola'
Giampaolo Rodola' added the comment: [...] I'd like a parameter for the offset, and another one for the number of bytes to send. To sum up, I think there's a fundamental confusion between blocksize and count in this API. Ah OK, I see what you mean now. If seems we didn't understand each

[issue21345] multiprocessing.Pool._handle_workers sleeps too long

2014-04-24 Thread Johannes Baiter
New submission from Johannes Baiter: While testing a module that uses multiprocessing.Pool to distribute load across multiple processes, I noticed that my test suite was copmleting very quickly (~0.15s) on Python 2.6, while Python 2.7 and above took around 10x as long (~1.6s). Upon debugging

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Claudiu.Popa
Claudiu.Popa added the comment: Your patch needs tests and documentation update. For examples, you could look in test_difflib.py and see how get_close_matches is tested. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Russell Ballestrini added the comment: get_close_matches() doesn't seem to have any tests... I suppose I should write them considering I'm changing the functionality a bit. TODO: write tests for * difflib.get_close_matches() * difflib.get_scored_matches() Determine if docstrings are

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Zachary Ware
Changes by Zachary Ware zachary.w...@gmail.com: -- stage: - patch review versions: -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344 ___

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Zachary Ware
Zachary Ware added the comment: Russell Ballestrini wrote: Determine if docstrings are enough to document the new function. No, Doc/library/difflib.rst will need an update. (Btw, I removed 2.7 from versions because 2.7 is not open to new features, bugs and security-critical enhancements

[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +giampaolo.rodola, gvanrossum, haypo, pitrou, yselivanov ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21340 ___

[issue21346] typos in test_itertools.py

2014-04-24 Thread Brian Kearns
Changes by Brian Kearns bdkea...@gmail.com: -- files: test_itertools_typos-py27.patch keywords: patch nosy: bdkearns priority: normal severity: normal status: open title: typos in test_itertools.py type: enhancement versions: Python 2.7 Added file:

[issue21340] Possible concurrency bug in asyncio, AttributeError in tasks.py

2014-04-24 Thread Guido van Rossum
Guido van Rossum added the comment: Looks like there is a bug in CoroWrapper -- when the assert in __init__ fails, __del__ gets called imediately after and that triggers this traceback. However I'm not sure what causes the assert to fail -- it looks like this is coming from sleep(), which

[issue21342] multiprocessing RLock and Lock raise incorrect exceptions when releasing an unlocked lock.

2014-04-24 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21342 ___ ___ Python-bugs-list mailing list

[issue21345] multiprocessing.Pool._handle_workers sleeps too long

2014-04-24 Thread Ned Deily
Changes by Ned Deily n...@acm.org: -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21345 ___ ___ Python-bugs-list mailing list

[issue21346] typos in test_itertools.py

2014-04-24 Thread Zachary Ware
New submission from Zachary Ware: Fixed, thanks for the patch! changeset 90450:1beb3e0507fa 2.7 Issue #21346: Fix typos in test_itertools. Patch by Brian Kearns. changeset 90451:901b9afc918e 3.4 Issue #21346: Fix typo, make message consistent in test_itertools. Pointed out by Brian Kearns.

[issue19662] smtpd.py should not decode utf-8

2014-04-24 Thread Sreepriya Chalakkal
Sreepriya Chalakkal added the comment: Hi Maciej, I am travelling now and it might take some delay for me to work on this! I got to know that you are working on RFC 6532. You might take this up and fix it as this is related to your work and I don't want to create delays. --

[issue21347] Don't use a list argument together with shell=True in subprocess' docs

2014-04-24 Thread akira
New submission from akira: *Popen([something], shell=True)* works but it is similar to *Popen([something, arg], shell=True)* that passes arg to /bin/sh on POSIX systems instead of something. It is best to always use a string if `shell=True` is necessary. It is a common confusion #20344,

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- nosy: +tim.peters ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344 ___ ___

[issue9291] mimetypes initialization fails on Windows because of non-Latin characters in registry

2014-04-24 Thread stoyanov
stoyanov added the comment: Alternative temporary solution def enum_types(mimedb): try: ctype = ctype.encode(default_encoding) # omit in 3.x! except UnicodeEncodeError: pass except Exception: #-- pass#-- else: yield ctype -- nosy: +quick.es

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Changes by Russell Ballestrini russell.ballestr...@gmail.com: Removed file: http://bugs.python.org/file35023/difflib-patch-to-save-scores-in-get-close-matches.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344

[issue9731] Add ABCMeta.has_methods and tests that use it

2014-04-24 Thread Claudiu.Popa
Claudiu.Popa added the comment: I have updated the previous patch, by documenting the new class method. -- versions: +Python 3.5 -Python 3.4 Added file: http://bugs.python.org/file35027/issue9731.patch ___ Python tracker rep...@bugs.python.org

[issue8297] AttributeError message text should include module name

2014-04-24 Thread Roundup Robot
Roundup Robot added the comment: New changeset d84a69b7ba72 by Ethan Furman in branch 'default': Issue8297: module attribute lookup failures now include module name in error message. http://hg.python.org/cpython/rev/d84a69b7ba72 -- nosy: +python-dev

[issue11874] argparse assertion failure with brackets in metavars

2014-04-24 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: Added file: http://bugs.python.org/file35028/format_usage.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11874 ___

[issue11874] argparse assertion failure with brackets in metavars

2014-04-24 Thread paul j3
Changes by paul j3 ajipa...@gmail.com: Removed file: http://bugs.python.org/file30941/format_usage.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11874 ___

[issue21348] File C:\Python27\lib\distutils\msvc9compiler.py, line 295, in query_vcvarsal l raise ValueError(str(list(result.keys()))) ValueError: [u'path']

2014-04-24 Thread Cris
New submission from Cris: I have Windows 8 64bit and Python 64bit (installed from here: https://www.python.org/ftp/python/2.7/python-2.7.amd64.msi) I also installed pywin32-214.win-amd64-py2.7 (from here

[issue8297] AttributeError message text should include module name

2014-04-24 Thread Benjamin Peterson
Changes by Benjamin Peterson benja...@python.org: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8297 ___

[issue20962] Rather modest chunk size in gzip.GzipFile

2014-04-24 Thread William Tisäter
William Tisäter added the comment: I played around with different file and chunk sizes using attached benchmark script. After several test runs I think 1024 * 16 would be the biggest win without losing too many μs on small seeks. You can find my benchmark output here:

[issue8297] AttributeError message text should include module name

2014-04-24 Thread Ethan Furman
Ethan Furman added the comment: Yay, 'resolved' ! -- stage: patch review - resolved ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8297 ___ ___

[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns
Changes by Brian Kearns bdkea...@gmail.com: Removed file: http://bugs.python.org/file35030/fix_winreg_setvalueex-py27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21349 ___

[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns
Changes by Brian Kearns bdkea...@gmail.com: -- files: fix_winreg_setvalueex-py27.patch keywords: patch nosy: bdkearns priority: normal severity: normal status: open title: crash in winreg SetValueEx with memoryview type: crash versions: Python 2.7 Added file:

[issue21349] crash in winreg SetValueEx with memoryview

2014-04-24 Thread Brian Kearns
Changes by Brian Kearns bdkea...@gmail.com: Added file: http://bugs.python.org/file35031/fix_winreg_setvalueex-py27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21349 ___

[issue18967] Find a less conflict prone approach to Misc/NEWS

2014-04-24 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: Added file: http://bugs.python.org/file35032/newsmerge.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18967 ___

[issue18967] Find a less conflict prone approach to Misc/NEWS

2014-04-24 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: Removed file: http://bugs.python.org/file35011/newsmerge.py ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18967 ___

[issue17552] socket.sendfile()

2014-04-24 Thread akira
akira added the comment: count and blocksize are completely different. *count* specifies how many bytes at most socket.sendfile should sent overall. It may change the result i.e., it may not be necessary that the file is read until EOF. It has the same meaning as *nbytes* parameter for

[issue17552] socket.sendfile()

2014-04-24 Thread Antoine Pitrou
Antoine Pitrou added the comment: I'm -1 about adding count *and* blocksize parameters. blocksize alone is good enough IMO and considering what I've just described it is a better name than count. I'm confused. Why is blocksize necessary at all? using os.path.getsize(file.name) looks

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Changes by Russell Ballestrini russell.ballestr...@gmail.com: Removed file: http://bugs.python.org/file35024/difflib-patch-to-save-scores.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Russell Ballestrini added the comment: Ok, this patch is ready for review. -- Added file: http://bugs.python.org/file35033/diff-lib-get-scored-matches-tests-and-docs.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21344

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Tim Peters
Tim Peters added the comment: I wonder whether this new function would attract any users, given that the user already has control over the smallest ratio that will be accepted, and over the maximum number of close matches returned. That's always been sufficient for me. What useful thing(s)

[issue21292] C API in debug fails

2014-04-24 Thread Steve
Steve added the comment: Indeed, but not defining _DEBUG for debug compiling is not realistic. Too many dependencies. I am not even sure it would work, because if we bind with the debug libraries, but build with the release headers, it might break. In any case it is not an option we have

[issue14218] include rendered output in addition to markup

2014-04-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: The link in the first message does not work. This should: https://docs.python.org/devguide/documenting.html The section under discussion, which pydev controls, as opposed to the full .rst doc at http://docutils.sourceforge.net/rst.html, is

[issue15569] Doc doc: incorrect description of some roles as format-only

2014-04-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: There are no versions for the devguide. There is another misplaced role: : option A command-line option of Python. The leading hyphen(s) must be included. If a matching cmdoption directive exists, it is linked to. For options of other programs or scripts,

[issue21344] save scores or ratios in difflib get_close_matches

2014-04-24 Thread Russell Ballestrini
Russell Ballestrini added the comment: At some point I plan to write a web API that accepts a word, 'doge' and returns a list of possible suggestions and scores. Later a did you mean dog style suggestion could be implemented on top. We compute the scores, and it is computationally taxing, we

[issue16574] clarify policy on updates to final peps

2014-04-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: With respect to editing final peps, I think this issue should be closed. The current PEP 1 statement accurately describes what we do, which is that in general we do not edit final peps. Moreover, Chris has not submitted a patch and I doubt anyone else knows

[issue17227] devguide: buggy heading numbers

2014-04-24 Thread Terry J. Reedy
Terry J. Reedy added the comment: The only change is that '25' is now '28'. A possible solution, without changing Sphinx, is to reduce the headers to a couple of words and put the question under the header, possibly in italics. *Q. How do I do this difficult thing?* A. Do 2 pushups, sleep 3

[issue11708] argparse: suggestion for formatting optional positional args

2014-04-24 Thread paul j3
paul j3 added the comment: This patch adds a ReGroupHelpFormatter class, which regroups positional arguments in the usage line as discussed before. It builds on the reworked usage formatter in bugs/python.org/issue11874 (which keeps usage as a list longer). For a complicate parser, usage

[issue11708] argparse: suggestion for formatting optional positional args

2014-04-24 Thread paul j3
paul j3 added the comment: This is a testing script for this patch. It is not a unit test. Example: p = argparse.ArgumentParser() p.formatter_class = argparse.ReGroupHelpFormatter p.add_argument('foo') p.add_argument('arg1',nargs='?') p.add_argument('arg2',nargs='?') a