Simple Class Question - need clarity please

Scott David Daniels Scott.Daniels at Acm.Org
Sun Apr 11 12:06:02 EDT 2004


Shalabh Chaturvedi (and before him Alan Gauld) gave lots of good advice
to Stevie_mac, including:
...
>>I'm also struggling with other things like...
>>Where do I save .py files?
>>Will 'import' find my files where ever they are? (obviously not but...)
> 
> Look for PYTHONPATH and sys.path in the documentation. Hmm, now I urge you
> to go through the entire tutorial - it doesn't take long!

Another technique to consider:

     I drop a file in my .../Python23/Lib/site-packages  directory.
It contains a line with an unquoted directory name to add to the path.
My  file is named 'projects.pth', but use any name you like as long as
it ends with '.pth' -- the name is unimportant.
You don't want it to conflict with names you are likely to get from
outside parties (third-party packages like PIL often use this
technique).  I should probably call it 'ScottsWorkingTopics.pth' by
that logic.

There is no restriction to naming a single directory, but each should
be on its own line.  If I ember correctly, starting a line with a
hash mark (#) should make it a comment, but check your python docs to
be sure.

In my case, again, the line is:    C:\Projects\Current\Python
I've never tried using windows magic like:
%USERPROFILE%\DeskTop\Py
for the path names; you could try it and report on the results.

>>What basic should be considerations when deriving classes?
I also usually try to derive from object (for "new-style" classes.
I don't even particularly need their features; I am simply getting
used to the way all classes will eventually work.

-- 
-Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list