[Tutor] Where is sys.py?

Lisi lisi.reisz at gmail.com
Mon Aug 22 15:45:29 CEST 2011


On Monday 22 August 2011 00:13:37 Steven D'Aprano wrote:
> > The modules within it must surely be somewhere too.  But since I can't
> > find sys, I obviously can't find the modules.  Again, I'd like to look at
> > them.
>
> I don't understand what you mean by "modules within it".

The problem may be that I have again failed to understand.

As I understand it, I can, should I wish to do so, write and save a subroutine 
that I wish to reuse rather than write the same subroutine out multiple 
times.

The book also says that one can import sys and then run the various commands 
within it.  It also appears to say that sys is a file, and I thought that it 
said sys.py existed.  Clearly, it didn't since it doesn't.

Anyhow, I therefore thought - erroneously - that if there could be commands in 
sys, then it must be possible to store subroutines in some sort of "envelope" 
so that I could import the "envelope" and call the subroutines as I wanted 
them.  Otherwise, storing short subroutines would appear to me to be a waste 
of time and effort.  By the time one has imported the subroutine and then run 
it, and done this for every one of a number of short subroutines, it would be 
quicker and easier just to run them when needed.

So I wanted to look at how Python itself does it, so that I could copy it.

a) I am clearly barking up a non-existent tree and b) the sooner I forget 
completely about the text that I was working from (I am still turning over in 
my mind the exercise I got hung up on) and focus only on Alan's, the sooner I 
am going to make some kind of progress!!

Lisi


More information about the Tutor mailing list