The path insert is fairly horrible but I don't believe it's recommended.
Setting the PYTHONPATH environment variable can be useful in a local project (e.g. export PYTHONPATH=. in the root of your project), then using packages and absolute imports if you've got a lot of modules.
You can also import local modules just by using their name e.g. import my_module to import my_module.py from the same directory.
I find the Ruby require system a bit too close to PHP for my liking. I prefer that Python and Java abstract away the file system. However, using Bundler to manage your dependencies and put them onto the Ruby path at runtime is better than anything Python has.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The path insert is fairly horrible but I don't believe it's recommended.
Setting the
PYTHONPATH
environment variable can be useful in a local project (e.g.export PYTHONPATH=.
in the root of your project), then using packages and absolute imports if you've got a lot of modules.You can also import local modules just by using their name e.g.
import my_module
to importmy_module.py
from the same directory.I find the Ruby require system a bit too close to PHP for my liking. I prefer that Python and Java abstract away the file system. However, using Bundler to manage your dependencies and put them onto the Ruby path at runtime is better than anything Python has.