3 ms·
In the space of shell programming, virtualenv and third-party Python libraries are irrelevant and unnecessary.
by gmfawcett 6y ago
In the space of shell programming, virtualenv and third-party Python libraries are irrelevant and unnecessary.
- rattray 6y agoHuh? That's only true if you don't use any libraries, right? What if you want to use something like delegator[0] to make running shell commands less toilsome? [0] https://github.com/amitt001/delegator.py https://github.com/amitt001/delegator.py
- lmm 6y agoPython with no libraries is still a much, much nicer programming environment than bash.
- dylan604 6y agoHow say you? To even ask the system a question in python, you have to "import os". Is that not a library? I'm not a python-first type of person, but I have hacked enough scripts to be functional. My one take away is how python core is not very useful, and to even remotely do anything one must have a list of imports.
- scoopdewoop 6y ago'os' is in the standard library, not a concern when discussing virtual-env and third party libraries.
- dylan604 6y agothen why must it be imported as a 3rd party? this is my question on python in general. i get needing to explicitly import things that are not part of the core/standard, but why are core/standard required to be imported? why can't the methods they provide not just immediately available. *clearly, i've never taken a python CS style class, but it this importing core functions is just strange to me
- gmfawcett 6y ago"Third party" means a third party provided it: not yourself, and not the Python distribution, but someone else. "os" is a second-party library. You didn't write it; it was included in the Python distribution for you. What you're asking, I think is why the "os" functions are not, in Python terminology, "builtins." The builtins are functions that are available without any kind of import: like len(), max(), sorted(), etc. https://docs.python.org/3/library/functions.html https://docs.python.org/3/library/functions.html Why do you have to "import os"? Python was designed that way, that's all. So were the majority of other languages that come with standard libraries. (JavaScript is one exception that comes to mind, but there aren't many such exceptions.) The discussion above relates to "virtual environments", which are ways to manage third-party dependencies. My claim is that virtualenvs, while handy for general-purpose development, are basically pointless for replacing shell scripts. You don't need them -- the core language and its standard library are sufficient for most shell scripting purposes. I'm basing this opinion on my ~20 years of using Python for this kind of work.