Changing python process name (or argv[0])

mike wakerly mike-list at wakerly.com
Thu Jun 5 01:15:37 CEST 2003


Hi Michael and Skip,

Thanks for the responses!

On Wednesday 04 June 2003 08:04 am, Michael Chermside wrote:
> Mike writes:
> > I think the functionality is desirable for some
> > (at least on Unix python), and this simple trick hardly warrants an extra
> > module if it is indeed acceptable in the python world.
>
> Mike, you have it exactly backwards. This simple trick hardly
> warrents inclusion in core Python when it can be implemented
> by an extra module. The fact that it _is_ a simple trick is
> a good reason to keep it as a module. The fact that it might
> not be portable to all operating systems is another good
> reason. Don't be afraid to use modules... that's what they're
> for!

Aiyee, I was worried about this; it is what my 'acceptable in the python 
world' qualifier was for. It may be a simple trick, or it may be expected 
functionality (if uncommon). Yes, I am all for using modules where 
appropriate; not everybody's hack needs to be part of python (see Perl..), 
etc.. I've only just discovered this trick and couldn't find much discussion 
on whether or not it is considered a kludge.

(An 'Argv_write' module just seemed a bit inelegant to my eyes; perhaps I 
underestimate the rarity of its usefulness, but [as in my original problem], 
I see few other ways to 'hide python' from unintelligent interfaces.)

So, it would seem that rewriting argv[0] is indeed not a necessary standard 
feature, since, according to Skip:

> In addition, the idea was rejected by Guido in the past (I remember because
> I proposed it).  I doubt he's changed his mind on the topic in the past few
> years.

I'll have to do some homework and find that thread; maybe it will reveal why 
argv rewriting is good/bad/standard/uncommon. 

Thanks all,
Mike






More information about the Python-list mailing list