5 ms·
I'd be happy to hear examples how Python 3 helps us in computational sciences. I've barely even tried it before and have used Python 2 a lot.
by knlje 10y ago
I'd be happy to hear examples how Python 3 helps us in computational sciences. I've barely even tried it before and have used Python 2 a lot.
- auxym 10y agoThe new matrix multiplication operator in 3.5 is nice syntactic sugar: C = A@B vs C = A.dot(B)
- I_deny_it 10y agoThis is the only compelling reason I've seen to switch to Python 3.
- drej 10y agoIt's not that it helps in a particular way (though more on that below), it's just that starting with Python 2 now necessarily leads to rewrites later on. While you can see packages not supporting Python 3 (there are fewer and fewer of those), in the future you will see the opposite, some project already announcing end dates for their Py2 support (IPython to give an example). I have to stress that I used 2to3 to tackle the vast majority of conversion issues. It was on a small codebase and, but still, it worked rather well. While I feel the transition has not gone terribly smoothly, I truly believe Python 3 is a better language - and as I noted in a different thread [0] - the unicode support alone is worth it (for me). While not significantly beneficial in the vast majority of computational sciences, it is helpful in some areas - linguistics to give an example. [0] https://news.ycombinator.com/item?id=12930793 https://news.ycombinator.com/item?id=12930793
- I_deny_it 10y ago> It's not that it helps in a particular way (though more on that below), it's just that starting with Python 2 now necessarily leads to rewrites later on. While you can see packages not supporting Python 3 (there are fewer and fewer of those), in the future you will see the opposite, some project already announcing end dates for their Py2 support (IPython to give an example). So, there's no benefit to Python 3, but we should all migrate to it anyways? You think Python 2.7 will die, but trust me as soon as the PSF abandons it, someone will swoop in and become the new defacto supporter. For many of us, stability is a feature, and the fact that 2.7 won't change in gratuitous ways is super attractive.
- sandGorgon 10y agoexactly. This is what i have always believed. just Google and Dropbox have too much py2 code to drop it or do a wholesale conversion. Nothing is going to be EOLed. Its going to be business as usual and the python foundation will never agree to killing python 2 in the next decade. the only way forward is through six ( https://pypi.python.org/pypi/six https://pypi.python.org/pypi/six) or something like it. Its well worth building and funding a python 2 compatibility layer in python3... and then moving to py3 runtime. im actually surprised that someone like Google is not throwing some funding towards building a compatibility layer.
- module0000 10y ago> I'd be happy to hear examples how Python 3 helps us in computational sciences Sir/Madam, I am here to make you happy then. Python 3's multiprocessing library is leaps and bounds "better" than python 2's. By "better", I mean faster(in my workloads) by 30-40%. If time is money, then that feature alone saves you both.
- I_deny_it 10y agoIf you really want to run faster, you should try a new language. 30-40% for multiprocessing is nowhere near the benefit you'd get from a single threaded implementation in C, C++, Java, Rust, Ocaml, Go, or even JavaScript or LuaJIT. Those runs between 10 and 1000 times faster (1000% - 100000%) than Python.
- dagw 10y agoThose runs between 10 and 1000 times faster (1000% - 100000%) than Python. They're faster than pure python in the general case, but once you throw numpy, numba, numexpr and cython into the mix and focus on numeric workloads, most of that difference disappears.
- _Wintermute 10y agoFor scientific computing I can't see many people making use of python's multiprocessing library. A lot of the time you're writing scripts that you might run a handful of times at most, or if speed is an issue you write it in c++.