25 ms·
Navigating the Postmodern Python World
- banachtarski 13y agoThis might seem very petty, but I avoid python just because of the dichotomy between Python 2 and Python 3. For me, there are plenty of other scripting languages at my disposal, and for things like numpy, or twisted, I have better alternatives too.
- dagw 13y agoHonest question. Outside of matlab and octave (both of which fall down in a bunch of other obvious areas), what scripting language offers anything close to an alternative to numpy/scipy?
- taheris 13y agoJulia is targeting the scientific computing community, and I'd love to see it succeed as it is a very well thought out language. The language is in active development, although it is still early days with library support currently lacking (namely, a good plotting library).
- ngoldbaum 13y agoAlthough there's a very sophisticated set of bindings that makes it almost trivial to call Julia code from python and vice verse, making it possible to use matplotlib instead of waiting for a solution written in Julia. Take a look at this [1] (skip to the ten minute mark for the PyCall stuff) presentation from this year's scipy conference. [1] http://www.youtube.com/watch?v=Eb8CMuNKdJ0 http://www.youtube.com/watch?v=Eb8CMuNKdJ0
- taheris 13y agoThanks, I wasn't aware of the PyCall library. This provides an incredible amount of interoperability between the two languages.
- draegtun 13y agoPDL (Perl Data Language) offers a great alternative - http://pdl.perl.org http://pdl.perl.org
- mwexler 13y agoI will throw out R just because it should be thrown out... there, out there, I mean. I know, it's a terrible language, but it is a great collection of capabilities. Quintessential example of love/hate.
- jnbiche 13y agoHe mentions one: Julia. It's still young, so not as many libraries available. But it's a very fast language designed for scientific computing.
- banachtarski 13y agoI use R, Mathematica, Haskell, Julia, or my own CAS that I built.
- bjz_ 13y agoWhat do you think of Mathematica? I've been toying with the idea of using it for sketching out ideas related to my computer graphics work, but it's a big investment. :/
- banachtarski 13y agoI found it's utility primarily is dynamically controlled visualizations, for example, when I wanted to see how residues were distributed in the C^2 plane for a certain class of complex functions. I'm not certain what sort of graphics work you are considering, but if it involves a lot of nonlinearity or higher level functions, it may be a good fit.
- gohrt 13y agoThat's bizarre. 2 and 3 are different languages, that conveniently are very similar. Do you avoid Ruby and Perl because each other exist? Avoid JS because jQuery and mootools both exist?
- untothebreach 13y agoI agree with your comment about 2 and 3 being different languages, but to be fair, Ruby and Perl don't share one set of libraries/extensions that may work on both, yet may work on only one. I don't find the jQuery/Mootools comparison relevant because neither of them are (or even claim to be) languages of their own.
- thetrb 13y agoI don't think Ruby and Perl are a good comparison to Python 2 and 3. Perl 5 and Perl 6 would be a better comparison.
- lightcatcher 13y agoExcept modify the scenario such that jQuery announced a few years ago that will not be adding any more features and only doing sporadic bug fix releases, and they suggest moving all development to mootools. However, almost all code is written for jQuery and its not trivial to port libraries and applications from jQuery to mootools. tl;dr: I don't think the Python2/3 : jQuery/mootools analogy is that fitting. On the other hand, I still happily use Python(2) for some things, but that is primarily because of familiarity and awesome tools like what was mentioned in the article (namely Theano and pandas). Once the Rust language becomes more stable, I hope to move most of my development to that.
- banachtarski 13y agoBoth Ruby and Perl are in active development. Both jQuery and mootools are in active development. Python 2 is not in active development and most of the useful python libraries are not ported to python 3. Your analogy breaks on a number of levels.
- Buttons840 13y ago
- dbecker 13y agoHow does the dichotomy between Python 2 and 3 affect your productivity or coding experience? I'm using 2.7, and I can't recall the existence of 3 ever causing a problem.
- wahnfrieden 13y ago2.7 is a dead language that won't receive new features. That's mostly irrelevant if you're not investing in the long, long term with your projects. Just a tradeoff to consider, since it could mean one day it'll be worth it to migrate to Python 3, depending on the sort of project you're working on. Yes, it's ok to be using a "frozen" language for many cases.
- leephillips 13y ago"there are variety of technologies encroaching on Python’s niche" It wasn't clear to me what in particular the author thinks is Python's "niche", so I didn't understand the point of the article as an article, although the content was interesting.
- anonymoushn 13y agoIt seems to be writing code that runs at native speed, is a LISP, or talks to the JVM. Not all three, but maybe two at a time.
- dkarl 13y agoI think Python's niche is understood to be as a readable, concise, batteries-included language suitable for scripting, prototyping, and application development on a small-to-medium scale (and large scale for some people, but that's controversial,) and serving as a convenient interface to C and C++ libraries in all those roles. Python differentiates itself from similar languages in the niche by elevating simplicity, explicitness, and readability over conciseness and expressiveness. That's the conventional wisdom, anyway. I'd say the biggest challenge to Python in that niche is the emergence of type inference for statically typed languages. Not too long ago, the difference between a statically typed language and Python was List<Foo> foos = new List<Foo>(); foos.add(new Foo(2)); foos.add(new Foo(4)); versus foos = [ Foo(2), Foo(4) ] Now, a static language might look more like this: val foos = List(Foo(2), Foo(4)) As far as I know, there still isn't a statically typed language that matches Python's simplicity and low barrier to entry, but I say that as someone who knows little about Go.
- hellrich 13y agoTry Groovy! def foos = [ new Foo(2), new Foo(4) ]
- dkarl 13y agoI've been writing a lot of Groovy recently, and it feels like Scala without type checking. That's not the worst thing in the world, I'd rather just use Scala. With Groovy, I get a lot of the expressiveness of Scala, but the lack of static type checking combined with Groovy doing its best to be magical is a recipe for bugs. For example, in Groovy, you can overload methods accidentally without a warning, which can create a hell of a surprise when somebody passes a null value. Rather than throw an error, Groovy dispatches the call to one of the methods even if neither one is more specific than the other. There's also this classic bug: def printOne(Collection c) { if (c.empty) { print("Collection is empty") } else { print(c.iterator().next()) } } Can you spot the bug? This code works for all Collections... except Maps. If c is a Map, Groovy translates c.empty to c.get("empty"). Constantly having to be on my toes to avoid stuff like that is a pain.
- jefftchan 13y ago(off-topic) Love the contact page [1] of this website. What are some other effective filters? [1] http://www.stephendiehl.com/pages/hire.html http://www.stephendiehl.com/pages/hire.html
- mjhea0 13y agoset up an API endpoint for receiving post requests so that people could send a json payload with their contact info.
- duggan 13y agoHah, clever. Bonus points if you don't need to run the code to figure it out (since the cipher is trivial and the ciphertext isn't particularly well obfuscated in the Haskell version).
- jmelloy 13y agoI wouldn't expect people with python to necessarily have numpy, though.
- dagw 13y agoPerhaps that's part of the filter
- gohrt 13y agoYeah, if one is going to use code as your contact info, and ake people stare at it, one ought to make it good code. After reading those weirdly-written snippets, I'm not comfortable with buying more code from the author.
- rantanplan 13y agoI don't think that these specific snippets act as a demonstration of the code he is going to write, in case you hire him. Just saying.
- alanctgardner2 13y ago
- ak217 13y agoThe article doesn't mention recent/ongoing improvements to PyPy in the "speed" section, and doesn't mention concurrent.futures in the "asynchronous programming" section. Seems incomplete to me.
- Permit 13y agoI take issue with the idea that you can count PyPy as a +1 for Python's speed without also counting it as a -1 for libraries. Especially considering SciPy and NumPy are not yet supported by PyPy, which means you lose out on a lot of libraries that depend on them. (For example, sci-kit learn). You can't say that Python has both speed and great libraries. It has one or the other. Hopefully this will change at some point and I'll be able to reap the benefits of both.
- MostAwesomeDude 13y agoIt is not up to PyPy to support non-pure-Python libraries; it is up to those libraries to fix themselves by evicting their C and FORTRAN balls and chains.
- Permit 13y agoAbsolutely. But that's somewhat tangential to the question of whether or not Python is fast AND has good libraries. Regardless of blame, it doesn't change the fact that Python doesn't meet that criteria.
- ori_b 13y agoIt might not be PyPy's fault, but it is PyPy's problem. If I have code that wants those libraries, PyPy is not an option. As an end user, I don't care who should fix it. I just know that I can't get my job done with PyPy.
- dbecker 13y agoThe Zen of Python states that "practicality beats purity." And the authors of numpy, scipy, pandas, etc seem to agree that it would be impractical to rewrite these libraries in the way you are suggesting.
- k_bx 13y agoReally impressed about examples with parametrized types (but I'd still better switch to Haskell for those :).
- lifeisstillgood 13y agoI like hacker ish approach to extending (abusing) a much loved language to bring in new ideas. But I am wary, despite being a python bigot myself, of usin one language for all these things. At a very early point down this road it is simply better to pay the cost of adding a new platform and using clojure to make my DSL In the end, for production, there is a fine line between bending and breaking.
- bsaul 13y agoi've been coding in python professionally for 4 years now, and i'm currently working on the biggest project i've ever worked on. to me, being scared of changing the signature of a function because the static analyser will not be able to spot all the places i've used this function is a real problem ( along with incomplete autocomplete ). i do unit test everything, but i'd like to keep unit tests for things a computer can not theorically do. since i'm still in the early phase of the project, i know that python expressiveness is an edge, but i'm looking right now at what's going to be the "definitive" language i'm going to rebuild my product for the next 3 to 4 years. Python badly needs optional typing. really. i'm pretty sure that would solve both the speed and tooling issues. right now, for me, it starts to become unsuitable as soon as you reach 5-10k lines of code and a team of 2.
- hosay123 13y agoTest suites are awesome
- drdaeman 13y agoRunning tests, even with coverage and quickcheck does not replace static verification. At very best, such tests can assert that program should probably work with some known probability. In contrast, strong statically-checked typing may be used prove that program produces results correctly to the extent type system may express the necessary proof.
- alayne 13y agoMost type systems in statically typed languages can't make that guarantee. For example I can use Java reflection to call a method, change the method's parameters, and my code will only fail at runtime.
- SCdF 13y agoThat's kind of silly. If you're using Java and altering method signatures at runtime using reflection you're either in a very niche field where perhaps you shouldn't be using Java, or you're nuts. Just because you can get around a feature doesn't invalidate that feature. I'm not sure how I feel about static typing in Java, but it does do what OP talks about, because by default you're not playing devils advocate with reflection.
- pjlegato 13y agoThe "postmodern" conceit is a bit of a stretch; link bait to lure in readers with liberal arts degrees.
- sp332 13y agoOr perl hackers. "I think there's still a big streak of Modernism running through the middle of computer science, and a lot of people are out of touch with their culture. On the other hand, I'm not really out to fight Modernism, since postmodernism includes Modernism as just another valid source of ideas." http://www.wall.org/~larry/pm.html http://www.wall.org/~larry/pm.html
- parkour 13y ago"it's simply that is that the" wat
- wes-exp 13y agoLisp has had metaprogramming, optional type declarations, speed, and DSLs since at least the '80s. This isn't some magic new technology just introduced by the shiny new languages cited by the author. http://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule http://en.wikipedia.org/wiki/Greenspun%27s_tenth_rule
- pjmlp 13y agoMany blogs nowadays are rediscovering computing history.
- foldr 13y agoLisp's optional type declarations don't provide any compile-time guarantees though, they're just hints. (Although some implementations do use them to make compile-time checks.)
- wes-exp 13y agoDepends what you are going for. If the point of type declarations is speed, I think most high-quality CL implementations will take advantage of a type declaration. If the point is compile-time type safety, yeah, that's a more obscure feature. Of course you can always use check-type for run-time type safety though.
- foldr 13y agoWell, in the context of refactoring, it's presumably compile-time safety that's relevant.
- ohyes 13y agoTechnically, your are correct. HOWEVER, In most of the compiled versions you set speed/space/safety/debug levels 1-3 and get different uses of the type hints. In SBCL, if i set safety/debug at high priority, I will get warnings or errors if I make a type mistake. Furthermore, there is an option you can turn on to make the type infrencer tell you what it is doing. Here's some example doc: http://common-lisp.net/project/cmucl/doc/cmu-user/compiler-hint.html#toc136 http://common-lisp.net/project/cmucl/doc/cmu-user/compiler-h... You'll notice that CMUCL's compiler is called 'Python' so technically, Python supports type inference. :)
- xrt 13y agoI should think OCaml or SML should be added to the mix. Neither has Async built in, but the other points are handled quite well. http://ocaml.org/description.html http://ocaml.org/description.html
- ekanna 13y agoOther main strength of golang is no run time dependecy! Making it highly distributable. And also cross compiles across different operating systems and different cpu architectures. This also should be mentioned in this article!