Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #10595

Re: Windows: setting title of console window

References <4E343E1C.90807@stoneleaf.us>
Date 2011-07-30 18:34 +0100
Subject Re: Windows: setting title of console window
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.1668.1312047290.1164.python-list@python.org> (permalink)

Show all headers | View raw


On Sat, Jul 30, 2011 at 6:23 PM, Ethan Furman <ethan@stoneleaf.us> wrote:
> 8<-- sitecustomize.py ---------------------------------
> class SetTitle(object):
>    def __del__(self):
>        command = ' '.join(sys.argv)
>
> sys.argv = SetTitle()

I'm afraid I don't understand this. Why create an object and do the
work in the destructor? When will the destructor be called? Will you
subsequently be overwriting sys.argv with the actual arguments?

This code snippet makes excellent sense if and only if it's executed
before sys.argv gets set to something meaningful. I'm just not
following how you organize for this to be the case. Is
sitecustomize.py executed before sys.argv is set, and is this affected
by the fact that it actually imports sys?

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Windows: setting title of console window Chris Angelico <rosuav@gmail.com> - 2011-07-30 18:34 +0100

csiph-web