TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

I don't like Python. Does that make me a bad person?

151 pointsby thedigitalengelalmost 15 years ago
I don't like Python.<p>I love C. I like C++ too. I used to write a lot of Java when I was a kid (as in high-school kid) but now that I've written quite a bit of C and C++, Java seems more like a toy language. I did enjoy Java back then, however. I yet to do any major work in C#, but it seems to be a powerful language, especially when handling certain kinds of complexity.<p>I've been learning LISP on weekends for two weekends now, and I find it interesting. I know little bits of Haskell (am planning to learn it later this year) and seem to like it too. Maybe I like the idea of liking Haskell, I'll know for sure once I actually start writing Haskell.<p>Coming back to the point - I don't like Python. I've never liked it. I've tried working on various Python projects but have always found some or the other excuse to prematurely back out. And mind you, I love coding - I spend most of my time writing code or learning new stuff about code.<p>My question to the hardcore python lovers is this (and mind you, by hardcore I mean the kind of people who wrote Exaile, not the kind who hack up a Python script every now and then to organize their iPod): No doubt many of you have come from C / C++ / LISP backgrounds. What is the paradigm shift you experienced? I look at a piece of C code in a certain way - how do I look at a piece of Python code? How do I think about Python? How do I think <i>in</i> Python (copied that one from Bruce Eckel)?

39 comments

amixalmost 15 years ago
Yesterday there was an interesting link on HN comparing NLP in Python vs. other languages: <a href="http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.html" rel="nofollow">http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.ht...</a>. I think this article shows the clearness of the Python language - - and this clearness and simplicity is the reason why I love to code in Python.
评论 #1463493 未加载
评论 #1463511 未加载
评论 #1463510 未加载
评论 #1463889 未加载
评论 #1463528 未加载
评论 #1463769 未加载
评论 #1463477 未加载
gte910halmost 15 years ago
I'm a guy from a C/C++ background who did linux kernel development, and picked up python along the way and used it to do desktop tools. I used python (without knowing any of it) to write a disassembler for a project I was doing in 2003 on a non-x86 processor. It took me 5 days to learn the language enough to do so and to write the entire tool, at which point I "got it".<p>First off, Java isn't a toy language. You've characterized it improperly. Java is a bureaucratic language. You have to cross your t's dot your i's, fill out your requests in triplicate at the FactoryFactoryFactory to get the objectOfYourDesire. Why is this so?<p>This comes back to how C++ works on projects, especially large projects and midsize projects with a couple mediocre programmers thrown in (because, in commercial software development, you rarely get control of your team). C++ does not work well for large team development unless 1&#62; You have very capable people 2&#62; and you can fire everyone who steps outside the "defined okay subset" of C++ you use on the project. The language is too big, certain parts make it too uncertain, etc, for people to just willy nilly use all the language features. So Java, is basically Sun's "redoing" of C++ where they took its wild west nature, and made a BureauDisney version where you can't do a dozen things that happens in C++ all the time when good programmers go off the reservation or bad programmers enter the equation at all.<p>C++ has uses, but it's the sulfuric acid of programming languages: you have to have good personnel control and fire those who screw around outside the boundaries of the right style. A programming group with one guy programming like C with classes and another guy programming like it's Ocaml without garbage collection, and you're in for a mighty piece of hell.<p>So that's where Java came from. That's why it is what it is, and I hope I've highlighted a non-business issue with C++ that comes up from it's overabundance of "understanding breaking powers" which don't mess well with total programmer freedom.<p>Now lets look at what python was, and what it is now: Python was originally designed as a substitute for the pascal/BASIC line of programming languages (specifically a language called ABC). It was designed to be very very clear. It still <i>is</i> very very clear. It is still quite terse compared with C++/Java/C, but it's wordier than perl and ruby, but very much clearer for even non-python programmers to decipher much of the time.<p>Over time, it grew into an Application development and webserver development language. Why?<p>It has a very easy way to interface to C code. This is important, because C does great module level integration, but once you get at the system level, you start to get issues with namespaces, tracing bugs, etc. So python became an alternative for tying C code together.<p>It writes very quickly. While you may not understand how to write it quickly yet, usually python/ruby/perl will be quite a bit more productive on a feature basis than Java/C#, and tons more productive than an equivalent C/C++ project. This has to do with the fact it takes very few lines of these languages to "do a job".<p>For you currently, you're possibly less productive in python right now than you are in C++; I've honestly found this doesn't hold true more than 40-80 hours into learning python development while doing a real project for almost anyone who can handle commercial C++ software development. The C++ people do python faster than they do C++ and it has many fewer issues in the end than C++ they would have wrote. We use weave.inline or something else to speed up the inner loops with some native C, if even required for that application, and all is good, it works just as fast for the user or application, and was completed much faster with much less obtuse bugs.<p>If you spend those 40-80 hours on the language, you too will likely be a faster developer in python than C++ for many features.<p>Some tips: You are not doing C, you are not doing C++, you are not doing Java. Don't pretend you have to do the bueracracy that those languages require. If you write a python program with absolutely no functions, it will run just fine. So if all you need to do is process a small amount of text or open a little server, you can do this in a flat file with just a series of lines of code striaght out of main() in a C program. However with the size and completeness of the python standard library, you'll rarely have to write the rest of the functions.<p>Secondly, it's important to learn idomatic python today. If you write things like "it's supposed to be" in python today, you get speed on par with C/Java (or only 3-5x slower), and it's really freaky to see an interpreted language do that.<p>Thirdly, it's important to <i>learn and use the standard language rather than writing code</i>. Python module of the week blog is a great resource to do this: <a href="http://www.doughellmann.com/projects/PyMOTW/" rel="nofollow">http://www.doughellmann.com/projects/PyMOTW/</a> Much of python's power comes from a stupidly complete standard library that does much of what you need to do so allows you to write 20 line programs.<p>Lastly, learn <i>easy</i> ways to fall back on C/C++ in python. This way when you use python for an application it turns out it's too slow for, you can still add a bit of C/C++ to get the speed you need. You can embed C++ inline and have it compiled on the fly with weave, so I suggest you learn that.<p><a href="http://www.scipy.org/Weave" rel="nofollow">http://www.scipy.org/Weave</a> for getting it<p><a href="http://www.scipy.org/Cookbook/Weave" rel="nofollow">http://www.scipy.org/Cookbook/Weave</a> for examples of use<p><a href="http://www.scipy.org/PerformancePython" rel="nofollow">http://www.scipy.org/PerformancePython</a> for examples of how fast this runs vs other things.
评论 #1463868 未加载
评论 #1465035 未加载
评论 #1463632 未加载
评论 #1463607 未加载
zephyrfalconalmost 15 years ago
I've been using Python since around 1996. Back then I had used, or was still using, C, C++, Turbo Pascal, Delphi, BASIC (groan) and assembler.<p>Python was so much more high-level than all these other languages that it was staggering. It was pretty weird to use it at first. Where are all the declarations? What are these "lists" and "dictionaries"? You mean I can just stick any old thing in an object or even a class? Etc.<p>Soon it became obvious how much more powerful this new language was, and I enjoyed replacing reams of Pascal/C code with a few lines of Python. I tried to use it at work too, but failed because it was considered "unmaintainable" by the powers that were (this was around 1999-2000). Of course, this just fueled the feeling of having an obscure but superior language rebelling against the big evil statically typed empire. :-)<p>Anyway, this used to be some of the appeal of Python. I suppose it still applies to some extent, although since then, Python has been passed left and right by languages that are more powerful, more flexible, more functional, more "fun", and whatnot. Nowadays there seems to be a meme going around claiming that e.g. Ruby is fun and flexible, while by contrast Python is boring and conservative. It wasn't always like that. I distinctly recall people discovering Python and exclaiming that "programming is FUN again!".<p>Then again, all of these things are in the eye of the beholder, mostly. If you don't like Python, no big deal, especially if you have both lower-level (C, C++) and higher-level (Lisp) languages at your disposal. (Personally, I used to think that Ruby was butt-ugly and uninteresting... these days, I have taken more of a liking to the spirit of the Ruby community, which (perhaps ironically) reminds me of Python's in the 1990s.)
messelalmost 15 years ago
<a href="http://tryruby.org" rel="nofollow">http://tryruby.org</a> You'll probably still dislike it. But at least you can feel more comfortable comparing python to something.<p>I prefer Ruby, but appreciate Python and Perl. I come from C/C++ coding for 14 years.
Estragonalmost 15 years ago
Yes, you're a bad person. We're assembling a re-education camp for People Like You right now.
kbobalmost 15 years ago
The paradigm shift is that in Python the most direct way is best.<p>Examples.<p>In Java, accessor methods are considered good style. In Python, directly accessing a member is better. (more concise, makes client code clearer.) If you need to do magic, you can use properties.<p>In C++ and Java, you use inheritance to denote which classes have a given behavior. In Java, you also use interfaces. In Python, you simply give a class the needed method(s). (I.e., you use duck typing.) That flattens or removes lots of class hierarchies. If you need to do magic, you can use isinstance(), issubclass() or hasattr().<p>In Python, you use the built-in types a lot. Many problems decompose easily to lists, sets and dictionaries. That reduces code dramatically. Java and C++ STL's containers, in contrast, are so clumsy they make me look for ways to avoid them. If you need to do magic, you can subclass the built-in types or build new types with the same methods as the built-ins.
experimentoralmost 15 years ago
Python is a great language. But there is nothing bad about preferring one language/style over another. There are great programmers in all the camps.<p>Try the other two scripting languages - Ruby and Perl. I would prefer Ruby. See if you like the way things are done there.<p>If you find that you are more at home with this language than Python, try analyzing what makes you prefer it over Python.<p>I would suggest you to start with the basics of the Ruby language, and then try building a simple web app with Sinatra. I find the Ruby style much more comfortable than Python.<p>But if you don't like any of these languages, its still well and good. If you get can shit done with C#, thats all it counts.
KirinDavealmost 15 years ago
A lot of us don't like Python. It's a language with a mediocre design, a somewhat frustrating syntax, and a stubborn refusal to commit to such essentials as real closures and lambdas.<p>It's basically a language written by a group of people who don't trust you (as a Python user) to be knowledgable and educated. Decisions have been made based on the assumption that you are bad at your job.<p>Now, everyone seems to comfort themselves with the notion of making it “easy for maintenance”; repeating “I am smart, surely, but not everyone can be as smart as I am.” But this is ultimately a dodge that feeds into the problem endemic to our industry: a disdain for everyone else and everyone else's methods if they differ slightly from our indoctrinated best practices.
评论 #1467604 未加载
cagefacealmost 15 years ago
You owe it to yourself to learn at least one dynamic high level language. The advantage of Python (and Ruby, which I prefer) is that, for the right tasks, it's an extremely productive language. Compared to C++ or Java you have to write far, far less code and you can usually find good libraries that reduce the amount of code you have to write even further. Python doesn't have the elegance or flexibility of Lisp, but it's an extremely <i>practical</i> language for getting anything done that doesn't need C++ performance.
评论 #1463767 未加载
Aegeanalmost 15 years ago
I am a day-to-day C programmer. I am surprised to hear Python did not fit well after C for you. In my view, Python is the like the easy scripting version of C. I first learned Tcl/Tk, then Perl, then looked at bash scripting (my god, horrible) and seen that the earlier three has some obscure syntax with some special meanings of $'s and @'s and hyphenated flags everywhere with no resemblance to C.<p>Then looking into python, I saw the same philosophy as C; A struct or an array? Use a nice dictionary, set, tuple or a list, nicely kept under the [ ] brackets. Throw them in for loops without the iteration integer. Its just all the same things I do in C but easier, with no cryptic idioms. That's why I love it.<p>I have 2 choices of languages for all my projects: C and Python
评论 #1464112 未加载
评论 #1467305 未加载
doosraalmost 15 years ago
I started off hating Python as well. I could not stand a language that didn't terminate statements without semicolons! :) And python just seemed a lot like Perl; when using both languages for large projects my code just seemed to degenerate to "hacky."<p>But I've grown to like the simplicity of Python. One thing I don't like is its threads implementation, however. Because of the GIL, multithreading (GUI + background thread) just doesn't work right. Maybe I'm using it wrong?
评论 #1463662 未加载
评论 #1464745 未加载
estalmost 15 years ago
&#62; I like C++ too<p>I never met a hardcore C++ guy claim they like C++<p>&#62; by hardcore I mean the kind of people who wrote Exaile<p>I think Python weren't meant to write desktop music players. Stuff like Zope are hardcore.
评论 #1463563 未加载
njharmanalmost 15 years ago
The biggest revelation Python gave me is peoples thought process/problem solving process/whatever you want to call it (I call it brains) work differently. And importantly peoples brains are wired to work really, really well with specific language qualities(dynamic, functional, boilerplateish) as manifested in specific languages. But really poorly with other qualities/languages.<p>So, no you are not a bad person. If you've given Python a honest attempt (took me a year to do that, I had whitespace hangup that was hard to get past), then you aren't missing anything either. Python just isn't the language for you. Move on, be happy.
terra_talmost 15 years ago
You don't have to like Python. I don't.<p>Of course, I don't have any pretentions of being a "good person" either.
neutronicusalmost 15 years ago
I don't much like it either.<p>Came from C++, learned Perl, got a job writing Fortran, learned Lisp. When hating on Perl came into vogue on the internet, I said to myself, okay, I will learn Python as a Perl replacement. It is a decent Perl replacement, what with all the libraries and the fact that it is shebang-able.<p>Now that I've dispensed with background, what I don't like about Python:<p>1. Assignments don't return values. I <i>hate</i> this. An example. I would like to write:<p><pre><code> if (m = re.match("woo, regular expression")): do some stuff with match object </code></pre> Instead<p><pre><code> m = re.match("woo, regular expression") if m: do some stuff with match object </code></pre> This obscures the fact that I only care about this match object if it evaluates to true.<p>2. List comprehensions kind of suck. [(a, b) for a in as for b in bs] is a <i>cartesian product</i> and not a zip? Really?<p>3. Loops don't help this either: There's no equivalent of the Lisp (loop for x in xs for y in ys do (stuff x y)). I have to explicitly loop over the index. This pisses me off.<p>4. I feel that I am generally shoehorned into creating and assigning more objects than I would like.<p>Honestly it seems kinda crippled in comparison to Lisp, which, by the way, <i>runs faster</i>.<p>I would go back to Perl if multidimensional arrays were not so godawful. Perhaps I should try Ruby.
评论 #1464774 未加载
twismalmost 15 years ago
I was in the same boat as you before, but it is now my "go to" language. It happened when I started using django. Just humor yourself and go through this tutorial:<p><a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/" rel="nofollow">http://docs.djangoproject.com/en/dev/intro/tutorial01/</a><p>Don't copy and paste the code in the tutorial and when they ask you to type something in the REPL, do it.<p>That's when it all started for me.
评论 #1463564 未加载
l0nwlfalmost 15 years ago
"My question to the hardcore python lovers is this (and mind you, by hardcore I mean the kind of people who wrote Exaile, not the kind who hack up a Python script every now and then to organize their iPod)"<p>I'm disqualified to answer - as I come in your so called second type (softcore python lover perhaps), people who uses python to fix things in day to day life.
endtimealmost 15 years ago
I like Python because, IMO:<p>* It's the most concise, expressive language I know * Friendly syntax: I just write what I'm thinking and it pretty much works * Most importantly: It includes a ton of functional programming goodies (of which I make liberal use), but I can still just say x = 1 when I want to. Best of both worlds.
l4ualmost 15 years ago
Do you hate scripting languages in general? Maybe you should compare python with other scripting languages.
评论 #1464376 未加载
评论 #1463479 未加载
评论 #1463471 未加载
Avataristicalmost 15 years ago
I still write most of my code in C. Could never really warm to C++ and Java was fun in the early days, but the sheer volume of API's, J2EE, et al eventually crushed my spirit.<p>It took me several goes to become friendly with Python. I find it excellent to try out algorithms. If I don't know how something is going to be best implemented, then writing a bunch of classes in Python and tweaking attributes and methods until the algorithm is as simple as can be helps me get there very fast.
评论 #1466497 未加载
Kaizynalmost 15 years ago
Programming languages all come with a specific mental model for how you're supposed to code in the language. That's why it's so useful to learn different types of languages so that you "pick up" those different ways of thinking. Everybody thinks differently so not every language is going to suit the tastes of every developer. You may find that Lua or Ruby are a better fit with your thinking patterns and that you are more productive using one of those as a scripting language of choice.<p>The power of scripting languages really come down to a very simple thing: each line of code in a scripting language is equivalent to roughly 5 to 10 lines in a systems programming language. You're doing the same mundane programming tasks but with fewer lines and getting nearly the same performance as if you had written the code in one of the systems languages. It really won't make much difference which one you use, you'll see the same productivity gains using Perl, Ruby, Python, Lua or practically any of the others. However, the more obscure the language you choose, the fewer developers and the fewer available libraries to use.
HarrySimonsalmost 15 years ago
I hate Python too, only because of its insistence on indentation and because of its verboseness relative to, say, Perl.<p>I'm not against the non-Perl philosophy of There Is Only One Way To Do It, but for God's sake, don't insist on indentation! I am under a personal vow that until Python lifts its indentation requirement (say, via a command-line switch), I'm no way using this language for my programming needs.
评论 #1463465 未加载
评论 #1463480 未加载
评论 #1463499 未加载
评论 #1463489 未加载
评论 #1463515 未加载
评论 #1463801 未加载
pyoberalmost 15 years ago
Before I ever encountered Python, I'd gotten pretty familiar with a wider variety of languages than C, C++, and Java.<p>So if you don't <i>have</i> to learn Python right now, maybe you should first learn Lisp, Haskell, or whatever else you want or need to learn that isn't much like C/C++/Java. I think you'll have more fun this way. :-)
ruealmost 15 years ago
I think an exhaustive answer is "mu". Focusing on the tools instead of the problem is bad.
sceleratalmost 15 years ago
Easy language to read, write, and maintain. Big standard library and lots of tools. Win.
j_bakeralmost 15 years ago
If you ignore the fact that this page is a bit biased towards python, it is a pretty good intro to Python if you're coming from a C++ or Java background: <a href="http://dirtsimple.org/2004/12/python-is-not-java.html" rel="nofollow">http://dirtsimple.org/2004/12/python-is-not-java.html</a><p>My personal experience is that the Java-ish languages encourage you to overthink problems a bit. Instead, I suggest that you just do what comes naturally. This will actually get you pretty far, as Python doesn't have that many gotchas (at least in comparison to Java or especially C++).
thejbfalmost 15 years ago
Languages fit you if your tasks are fitting to those languages. As far as I can see as a C/C++ programmer you should have been involved more lower-level issues rather than writing software standing on several frameworks. Java is not a toy language but it handles the stuff you were used to deal with almost automatically so it feels like it is.<p>So what kind of programmer are you? What do you develop? These questions are essential before making any advise.
评论 #1463561 未加载
expeditiousalmost 15 years ago
Python's alright, but it made me work too hard for what it does. I tried hard to like it but using Python for writing scripts I was constantly asking it, "why are you making me do extra work? Perl doesn't make me do half the crap that you ask of me" (ex. regexes, quoting, string interpolating). Also, Perl has the CPAN, so, I fired Python and use Perl.
shib71almost 15 years ago
Preference for languages can take into account everything from the syntax to the libraries to the community. It's not surprising when someone has strong opinions about them. The problem is when people get precious, but you seem to be straight up about it. And with C and C++ you certainly won't suffer because you aren't a Python guy.
scorpion032almost 15 years ago
Python people are too busy solving real world problems fast and quick and getting their shit done, to fall in love with python.<p>Tools are just tools. And I don't mean to come across as a jerk. I love developing. But that is as a means to an end, but not as an end in itself. - Those who like the latter, end up as research scholars; or Rubyists.
kunleyalmost 15 years ago
Disclaimer: I'm not saying this to start a holy war...<p>Try Ruby. It gives much more freedom than Python, not to mention countless way of shooting oneself in a foot (which you know already from the C family ;)
technomancyalmost 15 years ago
If you don't like Python, it may just be an indicator that you know more about functional programming than Guido, which is hardly a feat. Read his opinions about tail-calls for a good laugh.
3KWAalmost 15 years ago
A programming language is like a screw driver, the brand doesn't matter but what you do with it!
exitalmost 15 years ago
what don't you like about it vs python? it could be easier to respond to some specific issues.
flexterraalmost 15 years ago
Yes
adamilardialmost 15 years ago
yes
ahoyherealmost 15 years ago
I don't like Python, either. There's nothing wrong with disliking Python - there's lot to dislike. There's also a lot to like, for a certain kind of person - e.g. not you and me.<p>It's an aesthetic and personal choice.
grails4lifealmost 15 years ago
No.
jcapotealmost 15 years ago
Nope, I fucking hate python.