Pythonic Idiom For Searching An Include Path

Tim Daneliuk tundra at tundraware.com
Wed Jun 23 18:27:16 EDT 2010


Given a program 'foo' that takes a command line argument '-I
includefile', I want to be able to look for 'includefile' in a path
specified in an environment variable, 'FOOPATH'.

I'd like a semantic that says:

  "If 'includefile' contains one or more path separator characters,
   ignore 'FOOPATH'. If it contains no path separators, look for it in
   the paths specified by 'FOOPATH', beginning with the leftmost path
   first."

Is there a standard Pythonic idiom for doing this or do I need to cook
up my own.


TIA,
-- 
----------------------------------------------------------------------------
Tim Daneliuk     tundra at tundraware.com
PGP Key:         http://www.tundraware.com/PGP/




More information about the Python-list mailing list