Python equivalent to 'which'?

Sean 'Shaleh' Perry shalehperry at attbi.com
Tue Jul 30 13:36:14 EDT 2002


On 30-Jul-2002 Michael Gilfix wrote:
>   Seems like that might make a good convenience function in the
> os.path module. I'm sure many people have wanted such a function
> if they're using python for pure scripting. Perhaps you should try
> submitting a short patch...? Worst case, at least it'll get stored in
> the system.
> 

I wrote that in about a minute and a half.

Note it has a large assumption that PATH is defined and it is separated by
colons.  This makes it only truly useful on a UNIX box.  of course 'which' is a
UNIXism as well.  My point is, the python library is for the most part OS
agnostic so I do not see this fitting in too well.




More information about the Python-list mailing list