11 ms·
I've recently had to start writing python professionally and I'm not super impressed. My previous python experience was writing small services and fixing others
by Rapzid 10y ago
I've recently had to start writing python professionally and I'm not super impressed. My previous python experience was writing small services and fixing others code. Now that I'm working on larger "apps" it feels like a 90's language with all the rough edges and warts. I'd rather being working in a language with better language services and tooling, but python has numpy and all these data viz libraries so whatcha gonna do? At least I get a little reprieve with TypeScript; never thought I'd be so happy to work with the node platform, but there you have it.
3.5 looks attractive but there are just fundamental issues with the lang and language services. It's a bit like lipstick o... Well, I'm not going to say it.
- mkesper 10y agoWhat do you mean by "language services and tooling"? Python 3.5+ supports gradual typing, too so I'd be interested in a real comparison to Typescript.
- Zancarius 10y agoI'm wondering if the OP is referring at least partially to the state of Python packaging. There was an HN article just a couple weeks ago, I think, along these lines that may be contributing to the complaint. It seems odd to me given that pip has improved rather dramatically over the last 1-2 years (at least on *nix), so perhaps you're right regarding typing.
- mixmastamyk 10y agoTry PyCharm if you need that kind of support. I'm usually happy with just pyflakes and linters.
- vosper 10y agoPycharm tries really hard to paper over the lack of static typing in Python. Variable/function refactoring works mostly, code completion is acceptable (especially if you're inside a specially supported-framework like Django) and sometimes it'll show up a type error before your tests fail, saving you the time it takes up setup the test db, run the tests etc... I love Pycharm, and I think people who go without IDE support are masochists (I did it for a few years with Python, and I'm not going back) but it's not like the kind of tooling support you get from a proper statically typed language, where the IDE can do so much to help you. And I say this as someone who's been full time in Python for years. It's a fun language to write, with a wonderful ecosystem, but it's not good enough when your codebase gets big or you need to do major refactoring.
- crdoconnor 10y ago>Pycharm tries really hard to paper over the lack of static typing in Python. It does and IMO this is the wrong approach. I usually fire off a test and use that the push the code to the line I'm interested in, at which point I fire up IPython.embed(). That gives you perfect code completion, instant variable inspection (including instant docstring and code lookup) and the ability to execute and inspect on the fly. You can then fairly easily copy and paste the lines you want back to the text editor. IMO that's a step ahead of just having autocomplete in an IDE.
- vosper 10y agoThat sounds interesting, do you have any details (blog post, tutorial) on exactly how to do that?
- mixmastamyk 10y agoTyping is now available in recent versions of the language.
- Spiritus 10y agoWhat rough edges and warts? And what fundamental issues?
- deleted 10y ago[deleted]
- donquichotte 10y agoIt IS a 90s language! ;-) My main issue with Python is distribution. Oh, you're using it on Windows? No worries, just install matplotlib using pip. Oh wait, you need to install cygwin and a C compiler and for some weird reason it won't compile but no worries there is a website with Unofficial Windows Binaries for Python Extension Packages but it's still not working.... Numerical computations and plotting are also my prime use cases for Python. IMO it's the only real competition to Matlab in this area.
- toyg 10y agoThe problem you describe has been fixed with precompiled wheels. As long as projects make the effort to package them, there is no need for compilers now.
- afashglaksnhb 10y agoDon't know why this was downvoted. NB you need to upgrade your pip to the latest to use this if you are on Ubuntu LTS though. (But you are working in virtualenvs so this isn't a problem right?)
- inlineint 10y agoI think that Continuum Analytics does incredible work in this direction, so it is really possible to just do `conda install matplotlib` and install matplotlib on any distribution.
- fnord123 10y agoWindows still doesn't come with a C compiler? At least it finally comes with ssh, right?
- pjmlp 10y agoUNIX also not, since Sun decided it was a good idea to sell the SDK separately, thus leading some companies to sponsor the until then largely ignored GCC. The *BSDs and GNU/Linux variants are the exception to this. In any case, Visual C++ and the plain command line SDK are a download away.
- aidos 10y agoInterested to hear more specifics of the issues you have – "language services" isn't a term I've heard before. My feeling is that the python language is still one of the nicest around. It takes quite a bit of practice before you get good at writing it though. Distribution etc is a bit rubbish, but you normally go through that pain once and then just leave it alone.
- throwayguestman 10y ago> there are just fundamental issues with the lang and language services I'd rather listen to a podcast going in-depth on that theme.
- crdoconnor 10y agoI've maintained technical debt ridden code for most of my career - initially in C#, Javascript, also doing PHP and Java. Python is the only language for which it was remotely bearable. It has some warts (it is weakly typed in some respects) but the only languages that fix those warts have a pale shadow of Python's ecosystem and you typically cannot prototype as fast in them. As for tooling, it's probably got the best REPL (IPython) of any language.
- steinuil 10y agoI had to work with Python a few times in the past year and I really have to agree. The lack of proper lambdas, closures, its reliance on mutable data structures and imperative idioms, and the useless distinction between statements and expressions makes it feel like somebody was trying to write a modern language but for some reason stopped halfway. For example: you can't assign the result of an "if" statement. Why? Because it's a SyntaxError, no real reason. There is even an "ifExp" in the language grammar, but that's only for inline ifs. You can't have statements in lambdas, and map and filter are "unpythonic". Yet everybody feels like list comprehensions are the best thing after sliced bread, despite being the same thing. Closures are also clunky: you can define another named function inside a function and call it afterwards, and you can use functools.partials from the stdlib, but I think people feel like it's unpythonic and instead pollute the namespace with singleton classes that only have one method. Ultimately, to me it feels like this all hurts the composability of the idioms of the language. List comprehensions can be nested, but they feel clunky and they're in a syntactical wall garden. You can compose expressions, but not statements.
- Certhas 10y agoI extensively use closures in Python, particularly jit compiled closures with numba. I don't really have any problems with that, why do you say it's unpythonic?
- steinuil 10y agoI'm not saying they are, I don't think I've used the language enough to be able to tell what's pythonic and what's not. It's just that I think the language support could be better: why defining a function and calling it right after? That's what lambdas are for.
- StavrosK 10y ago> why defining a function and calling it right after? Documentation.
- 10y ago
- tannhaeuser 10y agoThe other week I've learned a bit of Python history I didn't know about. After listening to Steve Pemberton's talk ([1]), guys in the audience with ties to CWI (Amsterdam uni) pointed out to me that the language he and his team were developing at CWI was the precursor of what came to be Python. Specifically, they did usability studies with non-developers (but still engineers) to come up with ABC/Python's syntax (see the linked talk). So I guess that's something to keep in mind when comparing Python to functional programming languages/idioms. Another language coming out of this line of thinking and generation of programming languages, for me, is AppleTalk (or was it AppleScript?), so it could've become much worse I guess. [1]: https://www.youtube.com/playlist?list=PLQpqh98e9RgUcEmbXmI6RolisQaIRw9dm https://www.youtube.com/playlist?list=PLQpqh98e9RgUcEmbXmI6R... Edit: obligatory "what were they smoking" responses aside, anybody to chime in and complete/correct these early Python tidbits?
- jschulenklopper 10y agoMinor detail, but CWI (Centrum Wiskunde & Informatica - Centre for Mathematics and Computer Science) isn't a Dutch university. It is a national research institute, and part of the Dutch organization for scientific research NWO. Many members of the research staff teach at a Dutch university though.
- pjmlp 10y agoI know Python since the 1.6 version, could never convince myself to use it for anything else other than plain scripts, specially when I can get better performance and overall workflows out of Lisp and ML derived languages, without having to rely on C.
- willtim 10y agoHaskell and OCaml are also 90's languages. The rise of Python at the expense of safer, typed, faster, more principled languages makes me very sad for the state of our industry. I do not even believe it is the best choice for teaching programming to children. It heavily mixes and conflates higher-level ideas like lambdas and list comprehensions with imperative programming and mutation (the assignment syntax "x=x+1" must be especially confusing to high-school kids). It also throws in "object-oriented programming" constructs into the mix too.
- ue_ 10y ago>x=x+1 I've always heard this explained along the lines of "adds 1 to whatever x is, then puts that value into x, so x is one more than it was before".
- tim333 10y agoI first came across that as a school kid (in BASIC) and didn't find it confusing at all. I still find functional computing confusing - I mean to do something for the numbers 1 to 100 instead of for x = 1 to 100 you have to do some weird tail call recursion which if you are lucky the compiler then converts back to for x = 1 to 100 because that's how processors work efficiently.
- willtim 10y agoI learnt BBC Basic before my high-school algebra and was certainly confused by the different meanings. Don't concern yourself with tail recursion if you are still learning FP, it's just an optimisation, nothing to do with semantics. Python doesn't have it and few people care. What do you want to do with the numbers 1..100? A for loop doesn't give me any hints, which is part of its problem.
- lmm 10y agoDon't bother thinking about what the processor is doing. Just trust it to figure it out. Tell it what to do (which shouldn't involve "weird tail recursion" - rather you probably want to use "map" or similar), and let the runtime/processor do it for you. If and when it turns out to actually be too slowly, and you profile it and can't immediately see why, then you're allowed to worry about that kind of thing. Not before.
- moonshinefe 10y agoI'd absolutely love to hear what language you're using that's superior and not a "90s language" then. Pretty sure most of the popular languages date back to then if not a decade or two earlier. I find it especially amusing you cite typescript and the node ecosystem as superior. I've never seen such an unreliable and constantly changing ecosystem with dozens of frameworks and libraries ever in recent history.
- lmm 10y agoHaving used Scala I can't stand to go back to Python. Almost as lightweight (more lightweight in some places - case classes and "_ lambdas" are things I really missed in Python, though attrs maybe solves the first), but a whole lot safer, which makes it much easier to refactor, which makes it possible to maintain a much higher quality standard in a long-lived codebase. And the whole library/build ecosystem works a lot better - partly the problem is harder for Python because many "python" libraries rely on native code (whereas JNI is relatively rare), but it seems there are still four or five different ways to build and package Python projects and to work at an organization with a large Python codebase you end up having to understand all of them. (Every few years I see a blog post on how the packaging problem is totally solved now, for real this time, but at this point I've stopped believing them).
- crdoconnor 10y ago>And the whole library/build ecosystem works a lot better Seriously? Maven was one of the things that made me run away screaming from the Java ecosystem.
- lmm 10y agoSeriously. For anything more than a single developer maven is the best build system I've ever used by a long way, because its customizability is so limited: every project uses the same source directory layout, every project uses the same release tag format, every project uses the same unit test layout, and so you can immediately jump into any project and be productive. When you want to run random code in your build process it has to be encapsulated as a plugin, which means a) any random logic in the build process is at least ordinary first-class code that goes through your normal code review process, has a versioning and release cycle, can be unit tested etc. b) the slight extra overhead means there's more likely to be one standard plugin for doing a thing, which again means there'll be a standardised source directory etc., rather than everyone integrating thrift or swagger or what-have-you into their build in an ad-hoc and slightly different way. c) often people decide that actually they can live without having function names be capitalised if the build was made on a Wednesday or whatever nonsense they wanted to do to the build, and put their business logic in code where it belongs instead. Beyond that there's a working central repository where all the important libraries are (and it's one of the few ecosystems that actually enforces code signing of all published libraries), and also a free repository server that you can run on-premises (and that's a normal JVM app that runs like anything else in the ecosystem) and use for private publishing and/or to proxy remote repositories to make sure you will always be able to rebuild any previously successful build even if a remote repository goes down. The release plugin enforces good practices by default, e.g. you tag a release and rebuild from that release, ensuring you can always recreate any given release; you may build a -SNAPSHOT which depends on another -SNAPSHOT, which makes it lightweight to make a change to an upstream library and check that it has the right effect on your downstream application (and the first-class IDE integration dovetails very nicely with this), but releases are only allowed to depend on releases, which ensures they're reproducible and immutable. None of this should be hard, and I think other ecosystems are gradually getting it right, but Maven just seems to have managed to make all the right choices and avoid all the pitfalls. You don't hear as much about it as you do about, say, NPM, but I think that's at least partly because it rarely goes wrong, so a lot of the time it's invisible to developers.