msg122635 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2010-11-28 05:48 |
From the docs@ mailing list: “Tutorial 2.1.1: name 'sys' is not defined When the student tells python to evaluate sys.argv[0] as described, she gets the following error: name 'sys' is not defined” Imports have not been introduced yet, so I propose this simple change: -left in ``sys.argv`` for the command or module to handle. +left in ``sys.argv`` for the command or module to handle. You need to +execute ``import sys`` before you can reference ``sys.argv``. I’m not committing directly because I’d like feedback: Is the wording okay for the beginning of the tutorial? |
|
|
msg122636 - (view) |
Author: Ezio Melotti (ezio.melotti) *  |
Date: 2010-11-28 06:03 |
What about "In order to use ``sys.argv`` you have to import the :mod:`sys` module doing ``import sys``.". "reference" sounds weird to me, and imho saying "import the module" is ok even if imports have not been introduced yet. If the user doesn't understand what "importing a module" means he can just execute the command as is. |
|
|
msg122783 - (view) |
Author: Senthil Kumaran (orsenthil) *  |
Date: 2010-11-29 08:58 |
On Sun, Nov 28, 2010 at 05:48:20AM +0000, Éric Araujo wrote: > I’m not committing directly because I’d like feedback: Is the > wording okay for the beginning of the tutorial? It seems fine and useful. Please go ahead. |
|
|
msg122803 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2010-11-29 14:12 |
What about: “You need to execute ``import sys`` before you can use ``sys.argv``.” |
|
|
msg124100 - (view) |
Author: Éric Araujo (eric.araujo) *  |
Date: 2010-12-16 01:21 |
New wording: When known to the interpreter, the script name and additional arguments thereafter are passed to the script in the variable ``sys.argv``, which is a -list of strings. Its length is at least one; when no script and no arguments +list of strings. You have to execute ``import sys`` before you can use that +list. Its length is at least one; when no script and no arguments are given, ``sys.argv[0]`` is an empty string. When the script name is given as ``'-'`` (meaning standard input), ``sys.argv[0]`` is set to ``'-'``. When :option:`-c` *command* is used, ``sys.argv[0]`` is set to ``'-c'``. When |
|
|
msg124217 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2010-12-17 15:51 |
"Use that list" doesn't make me happy, what about "access"? |
|
|
msg124222 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2010-12-17 16:06 |
Attached diff provides another suggested rewording that I think is clearer. |
|
|
msg124223 - (view) |
Author: Georg Brandl (georg.brandl) *  |
Date: 2010-12-17 16:07 |
+1. |
|
|
msg124224 - (view) |
Author: R. David Murray (r.david.murray) *  |
Date: 2010-12-17 16:12 |
Committed in r87337. |
|
|