[issue9253] argparse: optional subparsers

2010-11-15 Thread G2P

G2P  added the comment:

Trying to spec this, here is a proposed API:

parser = argparse.ArgumentParser()
sub = parser.add_subparsers(default='show')
sub_show = sub.add_parser('show')
sub_add = sub.add_parser('add')

If default isn't passed, the subcommand isn't optional.
If default is passed, and no explicit subcommand is given,
the default subcommand is picked.
Arguments are given to the top parser; passing arguments
to the subcommand requires naming it explicitly.

As far as motivation, I'd like to change a program that
uses --choice options (that can have a default) to use
more expressive subcommands. Some programs rely on implicit
subcommands a lot; the ip command on linux is a good
example.

--
nosy: +G2P

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



[issue1520818] fcntl.ioctl fails to copy back exactly-1024 buffer

2012-10-06 Thread G2P

G2P added the comment:

The bug still exists in Python 2.6 (2.6.7-4ubuntu2). Python 2.7 
(2.7.3-5ubuntu4) works correctly. I don't have Python 2.5 on hand to check.

Here is a very simple test case:

import array, fcntl
buf = array.array('B', [0]*1024)
fcntl.ioctl(0, termios.TIOCGPGRP, buf, 1)
assert any(by != 0 for by in buf)

------
nosy: +G2P

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



[issue1520818] fcntl.ioctl fails to copy back exactly-1024 buffer

2012-10-06 Thread G2P

G2P added the comment:

Also happens in 2.5.2-2ubuntu6 and 2.4.5-1ubuntu4.2, FWIW.

--
versions: +Python 2.6

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