[Edu-sig] Bootable Python CDs?

David Boddie david at boddie.org.uk
Fri Apr 28 02:28:24 CEST 2006


On Friday 28 April 2006 02:06, kirby urner wrote:
> > If you're using an IDE, or even taking the traditional text editor and
> > console approach, I guess you wouldn't really need things like import
> > hooks/hacks to get where you want to go. Still, they might come in handy
> > for interactive work.
>
> Why do you call import a hook/hack?  It's just standard Python,
> typical at the top of any normal Python program.

It's a poor play on words. Just to explain, import hooks were formalized in
a PEP:

  http://www.python.org/dev/peps/pep-0302/

Before then (in Python 2.2), it was possible but not quite so straightforward
to change import behaviour.

> sys.path is where 
> the interpreter searches.  Nothing could be simpler.  Adding a new
> directory to sys.path is not any dark and mysterious hack.

That's true, even if the directory is specified by a URL referencing a
remote resource via HTTP. Ian's module focuses on this core feature; my
module is somewhat more contrived (a hack), and involves extracting Python
code from XHTML. For me, the ability to remote import .py files was a bonus.

> Typically you test things interactively but build your saved classes
> and functions in a module (a .py file).  Saving the interactive
> session directly is not very useful, except for later reference.  It's
> not executable code.  The prompt characters (>>>) get in the way.

Sometimes, when exploring an API or working through a problem, it's good
to be able to go back and see what worked and what didn't. I suppose it's
related to the old-style SAVE command, but not quite the same.

> > A save command (export hook?) that pickled and uploaded user-created
> > objects to a remote server might be useful in certain situations.
>
> This all sounds very baroque and like making something very simple
> into something very complicated.  I also don't recognize your jargon.
> Been using Python long?  Just asking.

I'm a relative newcomer to the language - I started learning it back in
the 1.5.2 days. I know some people here have been using it for much longer...

David


More information about the Edu-sig mailing list