Comment

Comment by ptx

> Why is a relative path in the PYTHONPATH necessarily bad practice? It's not a rhetorical question, I am genuinely curious.

Let's say you reimplement ls in Python. You then use your shiny new program to have a look at some downloaded files:

  $ ../utils/ls.py 
  ['hello.txt', 'os.py']
So far so good. Now let's try it with PYTHONPATH set to include the current directory:

  $ PYTHONPATH="." ../utils/ls.py 
  Boom! Your box is mine!
  ['no', 'files', 'for', 'you']
parent ptx 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton