5 ms·
For me, the only place where Python truly excels versus the competition is Numpy. The easy python scaffolding gets you to the heart of a problem in a friendly a
by vegabook 11y ago
For me, the only place where Python truly excels versus the competition is Numpy. The easy python scaffolding gets you to the heart of a problem in a friendly and flexible way, and then you can interface easily to this big V8 of a compute engine (especially if you combine it with the MKL libraries). The ecosystem around Numpy is astronomically good.
I have fallen in love again with Python (2) for this reason. I tried 3 but I don't need all it's accountant-like seriousness. It's less fun to code in. When I need to design for servers or for performance I will do golang or ocaml. When I need simple scaffolding for numerical work, and scripting for prototyping integration of various systems, Python 2.7 is like an old, unfussy, friend, helping me along my long and winding data wrangling road with a minimum of cognitive tax. It just works. Long may it live.
In my view the Python powers should look at numerical / data science and throw all of Python's weight behind that, and forget about the web, where they've already lost.
- alexhill 11y agoCan you articulate what you mean by Python 3's "accountant-like seriousness"? Is there more to it than print-as-a-function? I code in both every day and just don't see what the fuss is about. To me, they're barely different dialects; more like different accents.
- jMyles 11y agoThe many more generator-style iterables give it a strange dramatic tone to me. Also, the type hints syntax looks utterly un-fun.
- msellout 11y agoYou can ignore the type hints syntax. I plan to. Python 2: map(func, iterable) # returns a list Python 3: map(func, iterable) # returns an iterator list(map(func, iterable)) # returns a list
- jMyles 11y ago> You can ignore the type hints syntax. I plan to. I feel like that will be quite an ear-plugging, eye-covering endeavor. And that's really the point: it has the potential to create a community in which half the people are eyes-closed, ears-plugged. On your second point: Yeah, I don't mind casting things to a list. But it does seem... I guess, dramatic.
- tedmiston 11y ago> And that's really the point: it has the potential to create a community in which half the people are eyes-closed, ears-plugged. This is a big concern of mine as well, both before/after listening to Guido's keynote on Type Hinting at PyCon (https://www.youtube.com/watch?v=2wDvzy6Hgxg https://www.youtube.com/watch?v=2wDvzy6Hgxg). At first I thought type hinting would only really see adoption in performance-oriented sections of code, but I think we're all curious to see what best practices emerge in general, and in the open source side of things. Really the additional robustness it unlocks for IDEs like JetBrains is what got me really excited about type hints in Python.
- jMyles 11y ago> Really the additional robustness it unlocks for IDEs like JetBrains is what got me really excited about type hints in Python. Agreed. But that's only useful if the syntax is non-awful.
- msellout 11y agoIt's not technically a cast to a list. It's using the list constructor with the iterator as an argument.
- vegabook 11y agoFirst of all I don't think the print statement is a small issue. I bet 5% of my code is print statements. I love the print statement's unfussy "can do" mentality. Hey, the whole reason I got into Python was because it was utterly barebones. Print "hello world". that's it. You can almost feel the fun a young GvM might have had making it. Then all this u"xx" stuff on strings. What's that about? I don't care about unicode. 256 ascii characters is fine for me. If I need Unicode I can do it, but I don't need it by default. Iterators instead of ranges. Fine. Why again? To save memory? I've got 32 billion bytes. I don't need it. It's complicating something to please the computer scientists and it's messing with my mind which has far bigger problems to solve, so it's unpragmatic. If I see htop moaning about memory, I can easily change my code. Generally, I just like the 2.0 attitude. It's carefree. It just works. Three is trying too hard. Python is just a tool for me. My really hard problems are my daily battles with nonconvex optimization of vast data sets.
- delluminatus 11y agoI think you're confused about the strings. Python 3 uses UTF8 strings by default. The u"xx" syntax is only needed in python 2.x. In Python 3.x it's only supported for backwards compatibility.
- vegabook 11y agoright thanks for clarifying - I wasn't confused until Python 3 made it confusing. EDIT: Ah I remember. In one of my attempts to move to 3 I wrote a few modules which worked with strings, then I had to stick "u"s everywhere when I passed them to my 2 code base.
- tedmiston 11y ago> Then all this u"xx" stuff on strings. What's that about? I don't care about unicode. 256 ascii characters is fine for me. If I need Unicode I can do it, but I don't need it by default. I felt this way before I started spending all of my time on web apps. It's reading user input data from some random public source, like Twitter, that forces it upon you. Then, so quickly it became the best practice to "unicode all the things". I think of analogous to how we store timestamps in UTC always.
- tedmiston 11y agoThanks for taking the time to read. I agree with most of what you've said, but of course I still don't think Python has lost on the web, though that was my concern that sparked writing this post. What are your thoughts on the future of Python + NumPy vs. MATLAB or R? It seems the numeric and scientific community is embracing Python more, but what I've heard is mostly anecdotal.
- vegabook 11y agoI use R extensively, even more than Python, but it is not a robust language when your problem moves from exploration to anything resembling production. The memory management appears to be the problem. Hugely inefficient and slow even with 3.x. I get crashes frequently, even under Linux and I run production on R. Moreover, Numpy's two orders-of-magnitude speed increase opens up a new class of problem that R just can't handle, especially in the streaming data space. Pandas has made a big improvement in taking Python towards R, though it would be great if it were multidimensional. Where R has Python beat hands down is in its "vectors everywhere" functional philosophy. List comprehensions just don't match the power, and vector indexing is uneven even in Pandas. I have less experience with Matlab for cost, and lock in reasons. I need to have the option to distribute my code easily.
- Lofkin 11y agotoolz is pretty good at lazy fp in python : https://github.com/pytoolz/toolz https://github.com/pytoolz/toolz