8 ms·
I'm strictly a "scientific" programmer. I've used multiple languages in 40+ years, but only two lasted more than a decade: Turbo Pascal and Python. As Python ha
by analog31 4y ago
I'm strictly a "scientific" programmer. I've used multiple languages in 40+ years, but only two lasted more than a decade: Turbo Pascal and Python. As Python has passed the decade mark for me, I sometimes wonder why I'm still using it and what would make me get sick of it.
Some of my reasons for choosing Python in the first place have been mooted. Python is free, and multi-platform, but so is everything else nowadays. I think that battle is over.
For my use, packaging has not been a big obstacle, maybe because I tend to use a relatively small handful of established packages. I don't remember needing a package that I couldn't install with pip.
Easy to learn? Yes and no. I think a beginner can ease their way into Python and get productive, if they start with basic scripting and progressively adding a few language features. On the other hand, some features are simply over the heads of beginners, making the code found in packages practically unreadable. But I've never found any language to be better in this regard.
Fast? Sure, with numpy in its domain of use. Or writing your own C libraries. However, I think a beginner using numpy will run into roadblocks that require help from an experienced programmer, who can visualize what the array operations are doing under the hood. So, writing fast code isn't easier to learn in Python than in any other language.
The editor should have a final option, that turns your code brown if it's just so bad that nobody should ever have to read it, including yourself.
- blensor 4y agoI think one big factor is easy entry but almost no limit: Like BASIC back in the day it's a language that allows newcomers to do things long before they are comfortable with the added syntax requirements of C based languages Despite that the sky is the limit, almost all problems a developer will encounter can be tackled with python. Yes for many problems there are languages that are better suited for the task, but in most cases a project does never even reach a state where that will matter. And it's installed by default in many Linux distributions.
- 6gvONxR4sf7o 4y agoAnother big one that many languages treat as table stakes these days is the whole 'batteries included' thing. Whenever a new language comes out and I have to make my own (or install) core capabilities, it feels like a huge waste of time.
- analog31 4y agoHaving to piece together a Python installation can be an annoyance for a beginner. I always offer to help them set things up the first time. Since most of my workplace is on Windows, it's easy to have people install WinPython. This is especially true if they've already tried setting things up, and have made a mess of it. Because WinPython is self contained, it can work on a computer that already has a working or non-working Python installation.
- donkeybeer 4y agoWhat do you mean by piecing together a python install? Most linux should have one pre-installed or easily available via the package manager. After that venvs and pip seem to be generally enough for most tasks.
- ghshephard 4y agoI've been using Python for about 6 years, my last company wrote it's core commercial product exclusively in python. I've never used venvs, but I've yet to run into a situation where virtualenv (maybe with virtualwrappers as sugar), and pip + requirements.txt haven't been able to handle even fairly complex install situations.
- analog31 4y agoMy workplace is a Windows shop. I'm multi platform, but by and large the folks using Linux don't need my help. ;-) So when I help people its almost always on Windows.
- heavyset_go 4y agoPackaging Python applications that are outside of containerized apps can be a headache. You can't assume that the system's Python suits your needs, or even that Python versions in package repositories will, either. A big pain point still remains when it comes to packaging and distribution. It's not insurmountable, but if you're used to compiling and/or cross-compiling and shipping binaries, shipping Python apps can be headache inducing. The headaches increase when you're working with Windows or macOS, or using bleeding edge Python versions. That said, for 99% of Python apps out there, the default tooling should be absolutely fine for packaging and distribution, as should 3rd party solutions like PyInstaller or Nuitka.
- abdullahkhalids 4y agoI now use python, but Python is not even half the language Mathematica is for scientific computing. If only Mathematica was free, I think it would become the defacto language for scientists. The most important feature of Mathematica is that it is functional and not object-oriented. Mathematics is functional, not object-oriented. So thinking in Mathematica is as easy as thinking in maths. Thinking in python is to force yourself to think in an unnatural way.
- pharmakom 4y agoThere is Octave and Julia
- baq 4y agoMathematica is so much more it’s hard to even describe. It’s free on a raspberry pi, so if you have time and access to hardware, take a look.
- jrumbut 4y agoI think the so much more/hard to even describe is sort of a problem? There is a lot to it, and in my experience it's a very long road to getting your first problem solved. There are a lot of very cool pieces but I want it to be something I can pull off the shelf once in a while and be productive rather than something that I need to be an expert in before I can get started.
- prepend 4y ago> If only Mathematica was free, I think it would become the defacto language for scientists. Of course. It’s one of the few languages that I think are worth it. I’ve been waiting for Wolfram to open source it for 10 years as I can’t afford it, or really justify why my org should use it.
- ur-whale 4y ago> I’ve been waiting for Wolfram to open source it for 10 years as I can’t afford it, Wolframscript is free (not guaranteed to stay that way, as it isn't Open Source, but free for now). It can AFAIK do pretty much all Mathematica can. Only part missing is the Mathematica IDE/GUI/Notebook which I personally dislike profoundly anyways. Best of all, since it's a batch tool, it can be integrated in a Makefile and/or data processing pipeline without that nasty GUI showing up at all. https://www.wolfram.com/wolframscript/ https://www.wolfram.com/wolframscript/
- eointierney 4y ago"Can visualize what the array operations are doing under the hood" Either you take the time and trouble to understand what you're actually doing or you're just a lazy wizard with some facility for incantations.
- OJFord 4y ago> I don't remember needing a package that I couldn't install with pip. I don't think there's even a (reasonable/non-contrived) way that a package could be available to you that pip wouldn't install? (Or do you mean that you don't remember desiring a library functionality that wasn't available in some package?)
- vonseel 4y agoIt's rare, but I've run into packages that don't install easily with pip, due to not having binaries for a specific Python version + platform (something like this one where the combinations of Python+platform+MacOS version are limited, for example - https://pypi.org/project/virgil-crypto-lib/#files https://pypi.org/project/virgil-crypto-lib/#files ). Also there are probably tons of "packages" which were never published officially to pypi but exist on github, that people have made public but decided not to maintain.
- OJFord 4y ago> Also there are probably tons of "packages" which were never published officially to pypi but exist on github, I'm doing this from memory, it's hardly a frequent thing for me, but err something like: pip install -e git+https://github.com/vonseel/...
- heavyset_go 4y agoSome projects are distributed on PyPI as source code, and sometimes that source code has C modules that need to be compiled. The same can be true with packages that ship with Rust modules. Both might require you to have compiler toolchains installed.
- pid-1 4y agoAlso some compiled code might need to be statically linked to other deps. A practical example: on Windows, try 'pip install tokenizers'.
- 4y ago
- chestertn 4y agoHave you tried Julia?
- chestervonwinch 4y agoSimilar camp. Two reasons I enjoy Python, both related to documentation: 1. docstrings 2. keyword arguments Docstrings mean I can do REPL experiments without the additional friction of opening a browser to RTFM. Keyword arguments reduce how much I have to lookup the semantics of a function's signature.
- mnky9800n 4y agoBut I think this may be evidence for the argument that scientists should be paired with research software engineers who take the science codes and turn them into usuable libraries. Scientists don't necessarily need to produce codes that others use, simply ideas that can be translated into useful libraries. Certainly some scientists can do this themselves, but not all can nor should be expected to.
- singingfish 4y ago> The editor should have a final option, that turns your code brown if it's just so bad that nobody should ever have to read it, including yourself. Getting the editor to measure the cyclometric complexity of the code and then colour offending blocks?
- JKCalhoun 4y ago> On the other hand, some features are simply over the heads of beginners, making the code found in packages practically unreadable. That's too bad. I taught myself Python last year but have kept it pretty "101". That is, I write code simply. Since I am new to Python I don't know if the unreadable code you're describing is because it needs to be (perhaps I am still tooling around in the parking lot of Python) or if it is the result of programmers being too cool for school (ha ha). Perhaps if the latter I ought to blame the language for giving programmers a basement of esoterica to plunder rather than the programmers themselves. As obtuse as C could get with pointer arithmetic and the cryptic looking "question-mark-operator", there really wasn't much esoteric stuff in C. Contrast that to my experience with Swift where seemingly every week or so I would come across cryptic code where someone was using a capital T or some bizarre case expression I am unable to mentally parse. > Turbo Pascal You suddenly made me miss an ex-girlfriend. Maybe they still code in Turbo Pascal in Portlandia. I can dream.
- Tozen 4y agoThere's a fine one just like the ex, Free Pascal, waiting at https://wiki.freepascal.org/ https://wiki.freepascal.org/ to be checked out. Now the dream can become reality, but do take into account that satisfaction can depend on being realistic.
- perfopt 4y agoAah Turbo Pascal. That was the first "big pants" language I learnt and enjoyed. After that... C++ was fun initially and later felt way too featured. I don't like C++ code now (especially with heavy template use and stl and boost). I now code in Python (because most of the things I work on are in Python) though I don't like the dynamic typing. My potential new love is Rust but we are still working out some issues