[issue20598] argparse docs: '7'.split() is confusing magic

2016-04-26 Thread Berker Peksag
Changes by Berker Peksag : -- stage: patch review -> resolved ___ Python tracker ___

[issue20598] argparse docs: '7'.split() is confusing magic

2016-04-26 Thread STINNER Victor
STINNER Victor added the comment: Thanks. The doc looks better like that. -- ___ Python tracker ___ ___

[issue20598] argparse docs: '7'.split() is confusing magic

2016-04-26 Thread Martin Panter
Martin Panter added the comment: I committed my simpler patch. I hope that is okay :) -- resolution: -> fixed status: open -> closed ___ Python tracker

[issue20598] argparse docs: '7'.split() is confusing magic

2016-04-26 Thread Roundup Robot
Roundup Robot added the comment: New changeset 44f888e47ab0 by Martin Panter in branch '2.7': Issue #20598: Replace trivial split() calls with lists in argparse docs https://hg.python.org/cpython/rev/44f888e47ab0 New changeset 49561532504c by Martin Panter in branch '3.5': Issue #20598: Replace

[issue20598] argparse docs: '7'.split() is confusing magic

2016-02-13 Thread Martin Panter
Martin Panter added the comment: Here is a more conservative patch. What do you think Paul? * Keep all the changes to single-item and empty lists * Revert many of the other changes, except where there are only a few arguments and I feel it would make the section or piece of code too

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-28 Thread Martin Panter
Martin Panter added the comment: I don’t want to make any controversial changes. Half the purpose of the patch was to let people see what it would look like. Another option would be to only do the single or empty list changes, and leave most of the longer lists as they are with split().

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-28 Thread Martin Panter
Martin Panter added the comment: Here is a patch changing all the '. . .'.split() calls to lists of strings. I think the illustrations are actually less complicated to understand when you see the list directly, and they more consistent with the remaining illustrations that already use lists,

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-28 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Using str.split() for splitting full command line on arguments is anti-idiom. More correct way is to use shlex. But this is overkill for argparse examples (and in most cases we already have a list sys.argv). Explicit lists look clear enough. The patch

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-28 Thread SilentGhost
SilentGhost added the comment: I think it's worth saying that this wasn't a random choice intended to confuse beginners. Strings used represent input that is identical to the command-line input: if one wants to test it, one can just copy that string directly into the propmpt, it might be

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-28 Thread paul j3
paul j3 added the comment: I can understand changing '7'.split() but this change is IMO ugly: - >>> print(parser.parse_args('--foo B cmd --arg1 XX ZZ'.split())) + >>> print(parser.parse_args(['--foo', 'B', 'cmd', '--arg1', 'XX', 'ZZ'])) I've answered a lot of argparse questions

[issue20598] argparse docs: '7'.split() is confusing magic

2016-01-27 Thread Benjamin Peterson
Benjamin Peterson added the comment: I don't feel that strongly about it. -- ___ Python tracker ___ ___

[issue20598] argparse docs: '7'.split() is confusing magic

2015-02-16 Thread Julian Berman
Julian Berman added the comment: +1 to lists all over, this is just confusing. -- nosy: +Julian ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20598 ___

[issue20598] argparse docs: '7'.split() is confusing magic

2014-08-07 Thread paul j3
paul j3 added the comment: For documentation, ['this','is','a','test'] might be a bit clearer than 'this is a test'.split(). But generating a list of strings by split is, I think, a pretty basic idiom. But for testing purposes the split() version is a bit more robust because it is closer to

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-14 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- nosy: +eric.araujo ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue20598 ___ ___ Python-bugs-list

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread Thomas Guettler
New submission from Thomas Guettler: I think the docs of argparse still contain confusing magic: parser.parse_args('7'.split()) You know what it does and I know it. But a lot of people new to Python, don't understand what this should be. Please use: parser.parse_args(['7']) Close this

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread STINNER Victor
STINNER Victor added the comment: I agree that '7'.split() looks strange, an explicit list would be more obvious and simpler: ['7']. 'X --foo Y'.split() can be replaced with ['X', '--foo', 'Y']. argparse examples: http://docs.python.org/dev/library/argparse.html#type -- nosy: +haypo

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread STINNER Victor
STINNER Victor added the comment: @Thomas Guettler: Would you be interested to propose a patch on the source of the documentation directly? You can find the file here: http://hg.python.org/cpython/file/default/Doc/library/argparse.rst -- ___ Python

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread Benjamin Peterson
Benjamin Peterson added the comment: I agree that does look weird. However, it's nicely consistent with the the normal case which has multiple arguments like -foo 3 -l.split(). I think this is an excellent thing for newcomers to try out with the interactive shell. :) -- nosy:

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread Benjamin Peterson
Benjamin Peterson added the comment: IMO, keeping the string intact is slightly better because it's easier to read than a commandline with a bunch of quotes and commas in the middle. -- ___ Python tracker rep...@bugs.python.org

[issue20598] argparse docs: '7'.split() is confusing magic

2014-02-11 Thread STINNER Victor
STINNER Victor added the comment: IMO, keeping the string intact is slightly better because it's easier to read than a commandline with a bunch of quotes and commas in the middle. Many other argparse examples which use list literals. I don't see quotes in 7 string :-) --