[Tutor] Where is sys.py?

Lisi lisi.reisz at gmail.com
Mon Aug 22 19:38:11 CEST 2011


On Monday 22 August 2011 17:31:41 Alan Gauld wrote:
> Now I'm confused.

Yes, I'm afraid that _I_ was very confused.  I am gradually getting the mess 
in my head disentangled.

> There can be functions inside a module but not commands, they are
> technically something different and only exist within the Python
> interpreter itself. And you can access those functions from the module
> after you have imported it.
>
> I'm not sure what you mean by an envelope though?
> The module is the envelope...

By "envelope" I meant container, because I was afraid of misusing the correct 
technical terms.  I am still very confused by the terminology.  Having been 
told that modules, functions and methods are just different names for the 
same thing, that commands are really also the same thing and having had them 
called yet a fifth thing in order "not to confuse you" (ouch!!) I am in a 
right muddle.  What I am doing at the moment is trying to sort out the muddle 
in my own head.  You have no idea what a relief it was to be told (by you 
Alan in your text) that a function is a sub-routine.  I know what a 
sub-routine is!  And I shall just go on asking questions until I have got the 
whole thing disentangled in my head.  Sorry, everybody.  (Unlearning 
something is much harder than learning it.)

Alan, I did enjoy playing around with address books, which I can see have some 
point, instead of chasing bears, lollipops and flowers, or whatever it 
was. :-( 

So now, can anyone suggest an example of a module to look at?  (Preferably 
with some subroutines inside).It is clearly NOT just another name for 
function or method.  I imagine that there are some on the Internet?

> And I don't understand the bit about the time taken for short routines?
> Do you mean the time taken to access them in terms of typing time? Or in
> terms of execution time? It is faster to import than the time it takes
> to retype a function unless the function is only a simple expression.

I hadn't actually counted the keystrokes.  I stand corrected.  But saving 6 
keystrokes is still a fairly pointless thing to do.  If several subroutines 
can be stored in a module and imported together, then that is quite another 
matter.

Lisi


More information about the Tutor mailing list