Simple import question about mac osx

s0suk3 at gmail.com s0suk3 at gmail.com
Tue Apr 29 16:12:57 EDT 2008


On Apr 29, 2:17 pm, jmDesktop <needin4mat... at gmail.com> wrote:
> On Apr 29, 2:37 pm, "Jerry Hill" <malaclyp... at gmail.com> wrote:
>
>
>
> > On Tue, Apr 29, 2008 at 2:14 PM, jmDesktop <needin4mat... at gmail.com> wrote:
> > >  Thanks.  That worked on mac.  But it does work like I said in
> > >  Windows.  Don't know why.  Mr. Chun must also be using Windows because
> > >  that is the way he does it in his book.
>
> > It shouldn't work that way on windows either.  Can you tell us a
> > little more about what you mean when you say you "compile this" under
> > windows?  Normally, python code doesn't need to be compiled, so I'm
> > wondering if you're doing something different from what we expect when
> > you say you compile it and then import it in the interpreter.
>
> > Are you by any chance writing code in IDLE, running it, then doing
> > things in the interpreter?
>
> >  --
> > Jerry
>
> On Windows I took the text file I created on mac with vi and opened it
> in PythonWin.  I ran it.  It compiled.  I run the import and call from
> the python interpreter.

Well, Python compiles automatically any .py file that you import. Of
course this isn't machine code like the one from a C compiled
executable. It's Python's own bytecode. But normally you shouldn't
worry about that bytecode; actually, you shouldn't even be paying
attention to it. All that concerns you is that you created a module
and that you can import it. Leave the whole "compiling" concept to the
interpreter.



More information about the Python-list mailing list