11 ms·
I don't like Python. Does that make me a bad person?
I don't like Python.
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.
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.
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.
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 in Python (copied that one from Bruce Eckel)?
- grails4life 16y agoNo.
- HarrySimons 16y agoI hate Python too, only because of its insistence on indentation and because of its verboseness relative to, say, Perl. 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.
- jsankey 16y agoI've never understood this objection. Do you not indent your code anyway? If so, why should you also need to delineate scopes in another way? Python allows you to choose your indentation, it just requires consistency: something that is always required by coding standards (with good reason). If there was a command line switch, would you use it? Why?
- melling 16y agoI indent my Perl code. Not everyone does, however. It's a trivial task to reformat it in an editor. I guess the only complaint I might have is why bother thinking about indentation, ever? Throw in a couple of {} and now the tools can provide additional help.
- edanm 16y agoThe point is, I've never met a programmer who doesn't think of indentation. I've never seen a (real) project which doesn't have indentation. So if everyone is doing it anyway, why not take advantage of it and make it a part of the language? This way programmers learn to use indentation from the start (which any real programmer uses anyway), and indentation is always correct, nothing to ever think about.
- util 16y agoIt makes it harder to correctly do operations on code as text, eg, inserting a chunk of code from elsewhere or moving it out from or under an "if" statement. I have trouble with this occasionally working in emacs at least.
- edanm 16y agoThis does get to be a problem with people not indenting consistently. I.e., some code using tabs and some using spaces, and then copying between them. Technically, your editor should take care of that for you, but some of them don't do it properly (and sometimes can't do it properly), and it really sucks. Well, everything has a downside :)
- melling 16y agoShouldn't tools take care of that before a commit to svn, git, etc? Java has formatters, the Go language has one. Do any exist for Python or Perl?
- edanm 16y ago
- Jach 16y agoFirst, to the topic question, I'm not qualified by your criteria to answer the question, but I'll say anyway that I prefer doing video game programming in Python for 99% of the tasks that come up compared to C++. (For example, the PyGame wrapper for SDL just feels a lot better than the C++ interface, plus it adds some nice features.) My own take on mental models can be simplified with the example of strings. In Python, I can think of a string as a string, or a word, or a sentence, or an iterable list of characters. In C, I can't ever forget that it's all pointers. Python lets me think at higher abstractions more readily from looking at code. Plus I really love dynamic duck typing. And to the parent: I really hate to be "that guy", but can you give me an example where non-indented code looks better than indented code (since all your complaint really is about is style rather than what Python can help you do)? If it's just braces you're after, Python "supports" those by just commenting them out. When I first learned Python years back I was coming from a PHP and some Java background, and my code was sometimes single-space-indented, sometimes not indented at all, and it was hideous. After I realized I should be indenting anyway, Python made a lot of sense, all these languages with braces or 'end's everywhere didn't, and I can't think of any case I've ever thought "Man, I wish I didn't have to indent here." The one thing I can say I don't exactly like about Python now is the occasional self-hell.
- bad_user 16y agoSometimes I have trouble when breaking looong lines of Python code in multiple lines ... like for example when I have method chaining. I don't like long lines of code, it makes the code unreadable. Of course, most situations can be solved by a backslash-enter, and simple statements can be separated by ; but there are places where I wished for more flexibility. This is only about readability, and overall Python code tends to be more readable than in other languages, although I've read beautifully written code in Java or Perl or C++, and the readability really depends a lot on the programmer writing it. I think the major problem is the lack of focus in high-school / college on such things ... quite the contrary, many teachers are usually disconnected from real-world projects and don't have this skill themselves.
- birken 16y agoGoogle python style guide has a very good way of dealing with long lines: http://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Line_length#Line_length http://google-styleguide.googlecode.com/svn/trunk/pyguide.ht... In fact at Google the maximum line length for python code is 80 characters because long lines make the code unreadable, and following the style guide basically anything can fit in a nice and readable way.
- dnorris10 16y agoThe only reason I have had lately to get annoyed at Python is when one of the guys I'm working with on a project was using an editor where the tabspacing wasn't set correctly. That meant anything that he changed/added led to the script not working. Even though this was an easy change (=G in vim), it's still annoying to think that such a minor issue would completely kill the script. Of course I prefer Ruby, but that's a whole other can of worms :)
- cookiecaper 16y agoThe indentation is not a big deal at all. You indent your code anyway, right? Python doesn't enforce a specific standard, you can indent however you want, just as long as you use the same units of indentation consistently. The only time I've had a problem with indentation is while copy-pasting things, occasionally that can get messed up and be annoying. Everything else is fine.
- RodgerTheGreat 16y agoThe main reason I like having explicit braces and non-significant whitespace is that it allows me to use my whitespace flexibly to clarify the structure of a program. There are some interesting ideas regarding the use of whitespace in C here: http://www.quinapalus.com/coding.html http://www.quinapalus.com/coding.html I don't agree with everything he has to say- for example, I think his nested for loop example would be far nicer as something like this: for(i=0;i<10;i++) { for(j=0;j<10;j++) { for(k=0;k<10;k++) { printf("%d %d %d\n",i,j,k); } } } (Not to mention more in keeping with the principle of "alignment".) Still, if nonstandard indentation can make it easier to see the patterns in your code, it benefits both development and maintenance.
- thedigitalengel 16y agoWould it not be better this way: for (i = 0; i < 1000; i++) printf ("%d %d %d\n", i / 100, (i % 100) / 10, i % 10); IMHO, such patterns (multiple nesting with empty outer loops), in most cases, are really an indication of just one real loop. Using multiple counters might also be an option. In case the loops are doing something different, they should be indented separately. For instance, the following makes little sense: for (i = 0; i < 10; i++) { foo (i); for (j = 0; j < 10; j++) { foo (i + j); for (k = 0; k < 10; k++) { foo (i + j + k); } } }
- RodgerTheGreat 16y agoI absolutely agree with your second example, but I think you're missing my point for nested loops. Perhaps this would be a better example: Let's say I'm making a simple tile-based game that uses a two-dimensional array called "grid" to store the map. To draw that map to the screen, I might do something like the following: for(int x = 0; x < grid.length; x++) { for(int y = 0; y < grid[0].length; y++) { drawTile(grid[x][y], x * tileWidth, y * tileHeight); } } There are other ways to refashion this as a single loop, (storing everything in a 1d array and handling the dimensioning ourselves, using an iterator and giving tiles a position attribute containing their (x,y) coordinates, etc) but is any of that really more straightforward? Again, I am not arguing for indentation anarchy, merely that there are times when it can help to bend the rules. edit: I imagine you'd prefer something like this? for(int t = 0; t < grid.length * grid[0].length; t++) { int x = t % grid.length; int y = t / grid.length; drawTile(grid[x][y], x * tileWidth, y * tileHeight); }
- gaius 16y agoIn C and C-like languages, you have indentation for the humans and curly brackets for the compiler. Python simply unifies this into a single convention. Both parties "see" the code in exactly the same way. If you see someone else's code, there's never any ambiguity about what they meant.
- T_S_ 16y agoI'm glad I don't have to read your code. But I don't believe you should be downvoted. Only reformed. ;-) BTW in haskell whitespace is optional but nobody write code that way.
- amix 16y agoYesterday there was an interesting link on HN comparing NLP in Python vs. other languages: http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.html http://nltk.googlecode.com/svn/trunk/doc/howto/nlp-python.ht.... 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.
- paulgrahamsmom 16y agoAs my boy would say, if you aint using lisp yous using blub, and blub programmers get a spanking!
- nudge 16y agoThis is the main draw for me. Compared to Python, other languages (well, some) seem to require you to do so many things that just seem... unnecessary. I couldn't believe all the junk Java required of me when I took a stab at it. It's like being confronted with some unhelpful bureaucrat: I know what I mean, they know what I mean, but they're damn well going to make me trudge through all the nonsense so that what I mean is turned into something the bureaucracy understands. The linked NLP examples are great for illustrating this.
- thedigitalengel 16y agoJava is, as I said, a toy language. A language that needs you, the client programmer, to define getFoo () and setFoo () methods manually can't be right.
- exit 16y agoc++ feels incredibly bureaucrat to me too though. like separating definition from declaration into header files. what do you think of ooc-lang syntax? http://ooc-lang.org/ http://ooc-lang.org/
- thedigitalengel 16y agoI think the header-file and source-file distinction was more of an architectural decision (so that you could implement an efficient compiling and linking system) than a language design decision. Just an opinion, though.
- deleted 16y ago[deleted]
- l4u 16y agoDo you hate scripting languages in general? Maybe you should compare python with other scripting languages.
- paulgrahamsmom 16y agoMaybe you should use lisp, like my boy says to
- thedigitalengel 16y agoI don't have much experience with scripting languages - I've only written some bash scripts to automate stuff (other than Python, of course). Unless, of course, Brainf*ck counts as a "scripting language". :D
- squidsoup 16y agoI really dislike the term "scripting languages". While you could describe Python and Ruby this way, it does them a huge disservice, implying that they aren't capable of large scale application development. I think this term should really be reserved for Bash et al.
- prodigal_erik 16y agoI read "scripting language" as a legitimate warning about tradeoffs that make it unsuitable for high-volume use, because the code is permitted to change so much runtime behavior that most known optimizations (and other kinds of static analysis!) are ruled out. For example, Twitter's Ruby to Scala migration made news, so there's value in being able to broadly say what's different between those kinds of languages.
- pyober 16y agoBefore I ever encountered Python, I'd gotten pretty familiar with a wider variety of languages than C, C++, and Java. So if you don't have 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. :-)
- paulgrahamsmom 16y agoDid you read what my boy said about Python? He said they are smarter programmers. Who do you think you are?
- cookiecaper 16y agoLet's leave the meta-memes on reddit. This is a little bit personal to be funny imo anyway.
- paulgrahamsdad 16y agoHey, dont talk back to Paul's mother. Shes had a hard enough life raising a kid who cant decide if he is a hacker or a painter.
- shib71 16y agoPreference 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.
- deleted 16y ago[deleted]
- paulgrahamsdad 16y agoMy son doesnt like Java, is he a bad person?
- Estragon 16y agoYes, you're a bad person. We're assembling a re-education camp for People Like You right now.
- experimentor 16y agoPython is a great language. But there is nothing bad about preferring one language/style over another. There are great programmers in all the camps. Try the other two scripting languages - Ruby and Perl. I would prefer Ruby. See if you like the way things are done there. If you find that you are more at home with this language than Python, try analyzing what makes you prefer it over Python. 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. 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.
- paulgrahamsdad 16y agoI hate Blub. I taught Paul about Blub when he was just a boy. Mainly, the bigger kids would tease Paul for being such a geek, so to make him feel better I would tell him that those kids "where all just a bunch of Blub programmers!"
- messel 16y agohttp://tryruby.org http://tryruby.org You'll probably still dislike it. But at least you can feel more comfortable comparing python to something. I prefer Ruby, but appreciate Python and Perl. I come from C/C++ coding for 14 years.
- l0nwlf 16y 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)" 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.
- thejbf 16y agoLanguages 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. So what kind of programmer are you? What do you develop? These questions are essential before making any advise.
- thedigitalengel 16y agoCurrently I'm a student and question of what kind of a programmer I'm is wide open. I am currently working on a project that has to do with the GC and the JIT compiler for a language runtime. I plan to use my (remaining) student years to gain as broad a programming experience as I possibly can, not because I wish to be good at everything but so that I don't miss anything out. The whole point of this post was to find out that since virtually everyone finds Python so bouhaha and I don't, am I doing something wrong? Secondly I don't mean to criticize Java. By calling it a toy language, I was simply referring to the fact that Java tends to make writing bad code difficult, and in doing this takes away some of the flexibility and power that you tend to associate with other languages. I mean while (str++) str = (str) + 1; becomes for (int i = 0; i < sb.length (); i++) sb.setCharAt (i, sb.charAt (i) + 1); // and relevant casting While the above piece of Java code can be improved and condensed (for instance, by calling getChars and iterating through them* and then creating a new String - would be slow however), I think you get the point.
- thedigitalengel 16y agoIt seems some of the HN eats up some of the asterisks. But you get the idea.
- est 16y ago> I like C++ too I never met a hardcore C++ guy claim they like C++ > by hardcore I mean the kind of people who wrote Exaile I think Python weren't meant to write desktop music players. Stuff like Zope are hardcore.
- thedigitalengel 16y agoI never said I was a hardcore C++ guy. :) I'm more like a hardcore C guy. I do know a fair bit of C++ though. Perhaps C++ would've been better if compatibility with C was not kept as a fundamental goal. Just a personal opinion. Qt does an amazing job of taming C++. I used their framework for some GUI design and loved it.
- olliesaunders 16y agoI think what he is saying is, if you program enough C++, you'll grow to dislike it.
- twism 16y agoI 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: http://docs.djangoproject.com/en/dev/intro/tutorial01/ http://docs.djangoproject.com/en/dev/intro/tutorial01/ Don't copy and paste the code in the tutorial and when they ask you to type something in the REPL, do it. That's when it all started for me.
- messel 16y agoI was looking for a smooth way to ramp up my Python (very weak). Just had a little experience with it from the friendfeed api v2 on the app engine.
- exit 16y agowhat don't you like about it vs python? it could be easier to respond to some specific issues.
- gte910h 16y agoI'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". 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? 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> You have very capable people 2> 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. 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. 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. 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 is 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. Over time, it grew into an Application development and webserver development language. Why? 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. 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". 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. 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. 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. 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. Thirdly, it's important to learn and use the standard language rather than writing code. Python module of the week blog is a great resource to do this: http://www.doughellmann.com/projects/PyMOTW/ http://www.doughellmann.com/projects/PyMOTW/ 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. Lastly, learn easy 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. http://www.scipy.org/Weave http://www.scipy.org/Weave for getting it http://www.scipy.org/Cookbook/Weave http://www.scipy.org/Cookbook/Weave for examples of use http://www.scipy.org/PerformancePython http://www.scipy.org/PerformancePython for examples of how fast this runs vs other things.
- doosra 16y agoI 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." 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?
- jakevoytko 16y agoThe Right Way for a long time was to run multiple processes. If you absolutely needed threads, then the Other Way That Is Less Correct involved launching threads written in C from a C extension The Python community seems to be warming to the importance of threads. There are several efforts breaking their swords against the GIL nowadays (Unladen Swallow being the most prominent), and Antoine Pitrou wrote a new GIL to help improve contention [1]. With any luck, by the end of the Python Feature Freeze, there will be some significant headway towards efficient handling of threads within Python, but I'm not holding my breath yet ;) [1] http://www.dabeaz.com/python/NewGIL.pdf http://www.dabeaz.com/python/NewGIL.pdf
- jnoller 16y agoIf someone were to submit a patch nuking the GIL, I doubt it would be a language change, ergo, the language moratorium (a block on new syntax) does not apply.
- jakevoytko 16y agoI agree. To clarify, I'm hoping that because they're not focusing on language enhancements, they might make some major headway towards nuking the GIL
- eru 16y ago> I started off hating Python as well. I could not stand a language that didn't terminate statements without semicolons! :) I have exactly the opposite heuristic for syntax. The only thing worse than semicolons and curly braces, are `begin' and `end'.
- deleted 16y ago[deleted]
- terra_t 16y agoYou don't have to like Python. I don't. Of course, I don't have any pretentions of being a "good person" either.
- cageface 16y agoYou 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 practical language for getting anything done that doesn't need C++ performance.
- exit 16y agocurious what you prefer about Ruby. i'm very familiar with python, and have only looked at Ruby long enough to decide (mistakenly?) that it wouldn't do anything for me which python doesn't already.
- cageface 16y agoPython and Ruby are very much alike but I find Ruby more ergonomic. It's more consistently object-oriented, which means I spend less time looking things up because the core is easier to remember. The syntax is more expressive, which makes my code shorter and easier to read. The consistent use of blocks everywhere is more intuitive and consistent than Python's mix of loops and comprehensions. I find I can take in a block of Ruby at a glance. Python requires closer inspection. Everything in Ruby is an expression that returns a value whereas Python has statements and expressions and it's up to you to remember which are which. Ruby feels to me like the product of an astute student of languages that borrowed the best ideas from Smalltalk, Lisp, Icon etc. The design mistakes in the first versions of Python, mostly now corrected, suggest to me that Guido didn't do his homework as dilligently. Perhaps I'm way off here but the languages seem to me to show some of their cultural heritage. Python has a blunt & minimalistic Dutchness about it while Ruby has a Japanese elegance and style.
- dedward 16y agoThat's about it - Python has a richer, more refined set of libraries to call on than Ruby. (Ruby also has a ton...) Ruby is more fun,but python is more mature. In the end - whatever gets the job done right?
- technomancy 16y agoIf 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.
- kbob 16y agoThe paradigm shift is that in Python the most direct way is best. Examples. 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. 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(). 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.
- Avataristic 16y agoI 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. 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.
- CyberFonic 16y agoI didn't warm to Python until v2.2. Took an article by Eric Raymond for me to take another look at it and it finally clicked. Great for trying out ideas, etc. But I still write all the heavy duty stuff in C. Its really cool to do the heavy lifting in C and expose it as a shared library and then do the coordination stuff in Python.
- flexterra 16y agoYes
- scelerat 16y agoEasy language to read, write, and maintain. Big standard library and lots of tools. Win.
- zephyrfalcon 16y agoI'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. 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. 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. :-) 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!". 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.)
- neutronicus 16y agoI don't much like it either. 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. Now that I've dispensed with background, what I don't like about Python: 1. Assignments don't return values. I hate this. An example. I would like to write: if (m = re.match("woo, regular expression")): do some stuff with match object Instead m = re.match("woo, regular expression") if m: do some stuff with match object This obscures the fact that I only care about this match object if it evaluates to true. 2. List comprehensions kind of suck. [(a, b) for a in as for b in bs] is a cartesian product and not a zip? Really? 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. 4. I feel that I am generally shoehorned into creating and assigning more objects than I would like. Honestly it seems kinda crippled in comparison to Lisp, which, by the way, runs faster. I would go back to Perl if multidimensional arrays were not so godawful. Perhaps I should try Ruby.
- eru 16y agoPerhaps `zip' could help address some of your points? > 2. List comprehensions kind of suck. [(a, b) for a in as for b in bs] is a cartesian product and not a zip? Really? Strange. I would say it sucked if it was the other way round. You can use the `zip' function, if you want a zip. zip (as, bs) > 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. Try the function `enumerate' and `zip'. E.g. for x,y in zip(xs, ys): stuff (x,y) If you need an explicit index for your stuff: for (i, (x,y)) in zip(xs, ys): stuff (x,y) > 4. I feel that I am generally shoehorned into creating and assigning more objects than I would like. I agree, only the other way around. Python is much too destructive and relies on in-place updating. E.g. recently we got `sorted' that doesn't sort in-place but return a sorted array --- but the `shuffle' function still works only in-place. Also dicts are destructive. There should be a persistent (i.e. non-ephemeral) data structure for key-value-mappings in the standard library.
- rue 16y agoI think an exhaustive answer is "mu". Focusing on the tools instead of the problem is bad.
- deleted 16y ago[deleted]
- waterlesscloud 16y agoWhat's good about C++ is that I know it well, so it's comfortable for me. Why someone just coming to it now would like it, I couldn't tell you. I will say that when I came to Python I felt much lighter and faster as programmer. You forget how it can be. And starting into Clojure recently just feels more "right". I avoided Lispiness for a long, long time, but Clojure seems to hit the proper balance for me.
- j_baker 16y agoIf 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: http://dirtsimple.org/2004/12/python-is-not-java.html http://dirtsimple.org/2004/12/python-is-not-java.html 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++).
- endtime 16y agoI like Python because, IMO: * 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.
- Aegean 16y agoI 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. 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. I have 2 choices of languages for all my projects: C and Python
- mkramlich 16y agoAgreed. And interesting you said C and Python. A few years ago I was thinking about what would be the minimum set of languages that would be good to know in order to be able to do almost anything you wanted, and do it well, and to always be employable. I ruled out 1 language alone because of the C phenomenon: there's a whole class of software where today C is the best choice, and a whole different set where C is a bad choice. Therefore, the ideal set was 2+ with C being one. I ended up settling on C, Java and Python. Java for enterprise/BigDumbCompany work, but also because there's a lot of great tooling and innovation happening in the Java space more so than other langs. Python for the role of glue and prototyping and high level no boilerplate bureaucracy but where you could still trust every developer using it. Ruby could probably fill that role decently instead, except be a little better or worse in diff areas. C, Java, Python Then I found out that Google had picked these three as well. Nice!
- kragen 16y agoNo, Google picked C++, not C. Very different philosophy!
- mkramlich 16y agoThanks, looks like you may be right. I just found a post by Steve Yegge in 2007 where he said it was C++, Java, Python and JavaScript. I'm pretty sure I found references elsewhere to C/Java/Python though. Close enough. I had forgotten about JavaScript, I guess I considered that one a no-brainer on the browser side. However, the line blurs between C and C++, especially if you use the extra stuff only tactically as needed rather than a hard-core-always-OO-and-templates approach.
- njharman 16y agoThe 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. 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.
- scorpion032 16y agoPython people are too busy solving real world problems fast and quick and getting their shit done, to fall in love with python. 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.
- jcapote 16y agoNope, I fucking hate python.
- KirinDave 16y agoA 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. 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. 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.
- lelele 16y ago> 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. I agree about closures, but why lambdas would be so much better than named functions (already available)? I think named functions help code readability, which is among Python's top goals.
- KirinDave 16y ago> I agree about closures, but why lambdas would be so much better than named functions (already available)? Because sometimes you want to conditionally create functions on the fly. Named functions are a very awkward way to do this. It is unfortunate that we even have to have this argument. Anyone with significant experience in functional programming can tell you how useful unnamed functions are. And it's important to realize they are not necessarily anonymous in local scope. They're anonymous in the global scope. > I think named functions help code readability, which is among Python's top goals. Anonymous Lambdas need not be a detriment to readability. Why do you think it would be otherwise?
- Kaizyn 16y agoProgramming 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. 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.
- expeditious 16y agoPython'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.
- ahoyhere 16y agoI 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. It's an aesthetic and personal choice.
- 3KWA 16y agoA programming language is like a screw driver, the brand doesn't matter but what you do with it!
- kunley 16y agoDisclaimer: I'm not saying this to start a holy war... 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 ;)
- adamilardi 16y agoyes