[Tutor] Re: Tutor digest, Vol 1 #634 - 13 msgs

Stevenson M Hickey sthickey@juno.com
Mon, 5 Mar 2001 08:20:15 -0800


This message is in MIME format.  Since your mail reader does not understand
this format, some or all of this message may not be legible.

----__JNP_000_52c0.07ef.324a
Content-Type: text/plain; charset=us-ascii  
Content-Transfer-Encoding: 7bit

Alan Gauld wrote:

This works best if you are checkjing for type several 
times since the import overhead only gets called once.

> >     type(mystr) == type("") 

This is better if you only do it once since the extra 
function call is probably faster than importing the 
type module.

______

Am I misunderstanding something?

If you enter:  "import type" and hit return, are you not adding only a
pointer to the file 'type.py'?

I ask this, because, after having written 'import type',  you have to
instantiate a function in type.py by using the referrent preface --
'type.' in front of the function name, before you can use the function.

Secondly, when using IDLE, I noticed that I can use the function 'type'
without an 'import type' command.  Is this something in IDLE, or is
'type' a preferred function that is contained inside the Python
executable?  Of course, I am working on Windows (yech) and so do not know
what the 'REAL WORLD' viewpoint is!

So what's the Overhead for this?

If you enter 'from type import *'  then, I think, you would have the
overhead of each function in type.py being taken into Ram.  

Stevenson Hickey
----__JNP_000_52c0.07ef.324a
Content-Type: text/html; charset=us-ascii  
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR></HEAD>
<BODY bottomMargin=3D0 leftMargin=3D3 rightMargin=3D3 topMargin=3D0>
<DIV></DIV>
<DIV>Alan Gauld wrote:</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>This works best if you are checkjing for type several <BR>times since =
the=20
import overhead only gets called once.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; type(mystr) =3D=3D type("") </DIV>
<DIV>&nbsp;</DIV>
<DIV>This is better if you only do it once since the extra <BR>function =
call is=20
probably faster than importing the <BR>type module.</DIV>
<DIV>&nbsp;</DIV>
<DIV>______</DIV>
<DIV>&nbsp;</DIV>
<DIV>Am I misunderstanding something?</DIV>
<DIV>&nbsp;</DIV>
<DIV>If you enter:&nbsp; "import type" and hit return, are you&nbsp;not =
adding=20
only a pointer to the file 'type.py'?</DIV>
<DIV>&nbsp;</DIV>
<DIV>I ask this,&nbsp;because, after having written 'import type',  you =
have to=20
instantiate a function in type.py by using the referrent preface --=20
'type.'&nbsp;in front of the function name, before you can use the=20
function.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Secondly, when using IDLE, I noticed that I can use the function 'type=
'=20
without an 'import type' command.&nbsp; Is this something in IDLE, or is '=
type'=20
a preferred function that is contained inside the Python executable?&nbsp; =
Of=20
course, I am working on Windows (yech) and so do not know what the 'REAL =
WORLD'=20
viewpoint is!</DIV>
<DIV>&nbsp;</DIV>
<DIV>So what's the Overhead for this?</DIV>
<DIV>&nbsp;</DIV>
<DIV>If you enter 'from type import *'&nbsp; then, I think, you would have =
the=20
overhead of each function in type.py being taken into Ram.&nbsp; </DIV>
<DIV>&nbsp;</DIV>
<DIV>Stevenson Hickey</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV></BODY></HTML>

----__JNP_000_52c0.07ef.324a--