On Wed, 18 Sep 2002, Ype Kingma wrote:
> On Wednesday 18 September 2002 17:29, Douglas Reames wrote:
> > How do I add an entry to PYTHONPATH at run-time? With Perl, you add to the
> > path like so:
> > unshift(@INC, "C:\\Website\\include");
> import sys
This isn't quite equivalent to the original Perl statement: Perl's
unshift() function plunks elements at the front of a list, while Python's
append() plops things at the back. You can think of Python's append() as
analogous to Perl's push() function.
A closer translation would use the insert() method:
That being said, append() on a list is generally better because it doesn't
force the rest of the list elements to march up one position.
Hope this helps!