On 7/13/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote: > > Ka-Ping Yee wrote: > > > Having to 'import sys' to get at the command-line arguments always > > seemed awkward to me. 'import sys' feels like it should be a > > privileged operation (access to interpreter internals), and getting > > the command-line args isn't privileged. > > Would it help if sys were pre-imported into the builtins? > Or do you think that args shouldn't live in sys at all? > > Recently I've come to appreciate the ability to get at > the args from anywhere, instead of having to catch them > from a call to main() and pass them around. So I'd > like to still be able to import them from somewhere > if I want (doesn't have to be sys, though). > > And while we're on the subject, anyone think it would > be a good idea to drop the silly feature of having > the program name as args[0]? You almost *never* want > to treat it the same way as the rest of the args, > so the first thing you always do is args[1:]. > > It's not so bad in C, where it's just as easy to > start indexing argv from 1 instead of 0. But it > makes no sense in Python, IMO. It would be much > more sensible to move it into a separate attribute > of whatever module we decide to put args in. Makes sense to me. Ruby does this and it makes working with arguments a little bit nicer. -Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: http://mail.python.org/pipermail/python-dev/attachments/20060713/41f25f26/attachment.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4