<br><br><div><span class="gmail_quote">On 7/13/06, <b class="gmail_sendername">Greg Ewing</b> &lt;<a href="mailto:greg.ewing@canterbury.ac.nz">greg.ewing@canterbury.ac.nz</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Ka-Ping Yee wrote:<br><br>&gt; Having to 'import sys' to get at the command-line arguments always<br>&gt; seemed awkward to me.&nbsp;&nbsp;'import sys' feels like it should be a<br>&gt; privileged operation (access to interpreter internals), and getting
<br>&gt; the command-line args isn't privileged.<br><br>Would it help if sys were pre-imported into the builtins?<br>Or do you think that args shouldn't live in sys at all?<br><br>Recently I've come to appreciate the ability to get at
<br>the args from anywhere, instead of having to catch them<br>from a call to main() and pass them around. So I'd<br>like to still be able to import them from somewhere<br>if I want (doesn't have to be sys, though).<br><br>
And while we're on the subject, anyone think it would<br>be a good idea to drop the silly feature of having<br>the program name as args[0]? You almost *never* want<br>to treat it the same way as the rest of the args,<br>so the first thing you always do is args[1:].
<br><br>It's not so bad in C, where it's just as easy to<br>start indexing argv from 1 instead of 0. But it<br>makes no sense in Python, IMO. It would be much<br>more sensible to move it into a separate attribute<br>of whatever module we decide to put args in.
</blockquote><div><br>Makes sense to me.&nbsp; Ruby does this and it makes working with arguments a little bit nicer.<br><br>-Brett<br></div><br></div><br>