[Python-3000] Move argv[0]? (Re: Unicode and OS strings) (original) (raw)

Guido van Rossum guido at python.org
Sun Sep 16 04:01:00 CEST 2007


This sounds awfully close to bikeshedding. Change too many details like this and you cause death by a 1000 pinpricks for existing apps. sys.argv[0] does get used (though arguably rarely in the same way as sys.argv[1:]).

--Guido

On 9/15/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:

> Also "argv" sounds more low-level than something like "arguments".

While we're on the subject of argv, I've been wondering whether py3k might want to revisit the idea of having argv[0] be the program name. In my experience, one almost never wants to treat argv[0] the same way as the rest of the arguments. Putting the program name into argv[0] is a neat trick in C that's relatively harmless, because it's just as easy to start iterating from 1 than 0, but in Python it makes all argument-processing code more complicated than necessary. It also provides a nasty trap for the unwary, as I discovered one day when I wrote a program for deleting files that deleted itself the first time I ran it. :-) Changing the existing behaviour of argv would probably be too disruptive, so how about relegating argv to a low-level detail and providing something else for everyday use that omits argv[0]? sys.arguments would sound quite nice for that. -- Greg


Python-3000 mailing list Python-3000 at python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/guido%40python.org

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-3000 mailing list