3 ms·
Over my career, I've gone from loving Python, to having been bitten enough by it to evaluate and use other languages. Most of the time, it's "fast enough" for
by falcolas 12y ago
Over my career, I've gone from loving Python, to having been bitten enough by it to evaluate and use other languages.
Most of the time, it's "fast enough" for the job. But when it isn't, it really isn't.
Most of the time the standard libraries suffice for a job. But when they don't, you're suddenly in pip/easy_install hell. [1]
Most of the time you can get by with Python 3. But when you need to broadly distribute code with a dependency on a compiled binary, may the heavens help you. [2]
Most of the time, the syntax and "magic" won't bite you. But when it does, it does so hard. [3]
Most of the time, pylint/pychecker/etc. will find the same errors a compiler would...
You get the picture.
I still program with Python frequently, but I've increased the size of my programming language toolbox to compensate for its weaknesses.
[1] Or was that virtualenv, or setup.py, or apt/yum/nix, or...
[2] Broadly distribute means putting it on boxes where a C compiler is not available. This means you typically get to pre-compile those libraries and create either wheels or native packages. Not impossible, but for a "batteries included" high level language it's a lot of specialized low level grunt work.
[3] The infamous `def a(b=[]):` "feature" for one, anything involving metaclasses for another.
- pwnna 12y agoAs a side note, I have seen the `def a(b=[])` being used to have a static variable in a function.
- hyperbovine 12y agoCan someone elaborate on this? I thought I had seen all the Python idioms but this one is new to me.
- sherjilozair 12y agodef a(b=[]): b.append(1) print b Now if you do, a() a() you might expect to see [1] [1] but you will actually see [1] [1, 1] The list is not created at function call time, but at function definition time.
- ShinyCyril 12y agoThis has bitten me more times than I'd care to admit.
- abrahamepton 12y agoI find python by far my favorite language to have used, but I basically agree with this. No language is perfect for every use, nor could there ever be such a language (until computing changes dramatically, anyway; quantum computing maybe?) Until then, even a language one loves deeply - and I'm not sure I'm there yet with python, though i'm closer than with any other language I've used - will have flaws and times where it's not the best tool for the job.
- mpthrapp 12y agoAs someone who is currently "In Love With Python", I'm curious what other languages you recommend? I'm always looking to learn new stuff.
- falcolas 12y agoDepends on what you want to do. Go is a fairly strong candidate for a straight up replacement for Python, but there will be a lot of newer things to learn with regards to using a compiled language without a repl, and the lack of traditional polymorphism. Another good one is any kind of functional language, be it Haskell, Clojure, or OCaml. Learning how to think functionally will help your Python code quite a bit. At some point in the future, Rust would be a good one to put on your list, but I don't believe that it is in a great place right now. It's getting better, but I don't feel that it's ready yet for production development. I think Mozilla can get away with it because they own the minds who are developing the language, and as such can hit the moving target which Rust currently is.
- mpthrapp 12y agoI'm not quite sure what I want to do, other than I don't want to do front-end development. The other language I have any experience in is Delphi, which is a compiled language. I have heard a lot of good things about Go, maybe I'll give that a shot. I'd love to learn a functional language. I've looked at Haskell, and ouch. As someone with no formalized CS training, a lot of the type theory stuff goes right over my head. Is there a less crazy functional language you would recommend? Yeah, I've looked a little at Rust, and it looks like it'll be interesting in a couple years.
- falcolas 12y ago> Is there a less crazy functional language you would recommend? Clojure. It's a well supported and documented dialect of Lisp, which is a fundamentally functional language (though not purely functional), implemented on a platform that just about everyone has access to: the JVM. The more you can minimize your use of the dot operator (which implicitly means minimizing your dependence on Java libraries), the more you'll learn about functional programming.