dannyman.toldme.com


Technology

Why Python Sucks

Say, I want to know the semantics of a built-in function. In Perl, I type in perldoc -f <function-name>.

In Python, I have to go searching on the web, and the best thing I can come up with is a third-party HOWTO, which amounts to a tutorial on how the function works, rather than a quick, fifteen-second reference on calling semantics.

Dang.

Read More

Next:
Previous:
Categories: Technology
Possibly-Related Posts
Extra Crazy
Breakfast Party
JavaScript Hack: Hide an Element on a Page
Brooklyn Rooftops
Kitchen Appliances
IMG_10000

  • renbing

    just type help(something) can work.

    keep document string with everything you wrote, and
    you can use help(something) all the time

  • http://dannyman.toldme.com/ Danny Howard

    <SmooveB> danny, your “why python sucks” entry is wrong.
    <SmooveB> you can type pydoc function
    <SmooveB> or pydoc lib.function
    <dman> dbt: Yes.
    <SmooveB> in fact, pydoc is better than perldoc
    <Ark> of course it is!
    <dman> dbt: But the documentation sucks in comparison to perldoc.
    <Ark> its python!
    <Ark> python is like europe
    <Ark> everything is better!
    <SmooveB> because you don’t have to know perldoc -f for built in functions.
    <SmooveB> Ark: wank wank knee jerk wank wank :)
    * dman jerks off.
    <SmooveB> dman: what are you talking about?
    <Ark> hey, if I’m gonna constnatly give Matt shit about not liking stuff
         because said stuff is popular
    <Ark> I’m just gonna constantly bang on python
    <Ark> and your mother
    <M> SAY NUC-U-LAR!!! SAY IT, BITCH…OHH!! OHH!! YESSSSS!!!!1
    <Ark> cuz really, what else do I have to do all day but be Eliza-like in my
         mocking?
    <dman> I was frustrated I think becauise I wanted to do something with a
         linked list or something. It was long ago … anyway, Perl
         documentation is very good, and you can usually pull up great stuff on
         the command line. I was finding that Python equivalents were terse
         little things of a few lines at most leaving much to ambiguity.
    <dman> Like, what is a Python function related to list or array management?
    <Ark> I am pissed at the lack of documentation in Roma v0.3
    <Ark> s/Roma/Rome/
    <Ark> damn sun code
    * dman shrugs.
    <SmooveB> dman: pydoc list
    <dman> Today we are checking backlinks for funness. :)
    <SmooveB> builtin types have named types that you can look up docs for. :)
    <Ark> I think I shall go to Borders
    <dman> | pop(…)
    <dman> | L.pop([index]) -> item — remove and return item at index
         (default last)
    <dman> 2-10:13 djh@ratchet ~> perldoc -f pop
    <dman> =item pop ARRAY
    <dman> =item pop
    <dman> Pops and returns the last value of the array, shortening the array by
    <dman> one element. Has an effect similar to
    <dman> $ARRAY[$#ARRAY--]
    <dman> If there are no elements in the array, returns the undefined value
    <dman> (although this may happen at other times as well). If ARRAY is
    <dman> omitted, pops the C<@ARGV> array in the main program, and the C<@_>
    <dman> array in subroutines, just like C<shift>.
    <dman> (for purely arbitrary example)
    <SmooveB> ok, the extra documentation is mostly centered around perl’s
         terminally weird syntax and stupid implicit argument behavior.
    <dman> Uh huh.
    <dman> What happens if you pop a non-existent index?
    <dman> What happens if you pop an empty array?
    <dman> We do not know unless we try.
    <dman> What exception will be thrown?
    <dman> What is a similar way of going about the same thing?
    <Ark> I really would like to learn the python
    <Ark> I should just say “okay, instead of doing this in <foo> i’ll do this in
         python”
    <Ark> next project
    <Ark> next scripting project, that is
    <dman> The online Perl documentation has proved more accessible for me than
         the python equivalent.
    <dman> Dave, Keith, may I blog this? :)
    <Ark> what’s that?
    <SmooveB> “blog this”
    <Ark>      Writer w = response.getWriter();
    <Ark>      SyndFeedOutput output = new SyndFeedOutput();
    <Ark>      output.output(feed, w);
    <Ark> hooray for dumb looking sample code!
    <dman> See last comment at
         http://dannyman.toldme.com/2003/02/19/why-python-sucks/
    <dman> HAHAHAHAHA I AM LAME

  • http://meat.net/ dbt

    yes, danny, yes you are.

  • http://afoc.k.vu/ free-zombie

    lol. This is top-on-google for “python sucks”. And this is lame. Proof that python rocks, right ?

  • TiCL

    Perl >> Python, and the only reason is CPAN and the vast amount of documentation and examples it provides.

  • Ben

    If Python doesn’t suck, then why do 50% of the Python programs I try to run (on several Linux distros, FreeBSD and Mac OS X) die with a stack trace?

  • LKRaider

    @Ben:

    please, name three.

  • thedonvaughn

    so is this site about big pythons? I love pythons. They are big. They are pythons. My python ate my mother’s perls. The python than poop out the perls. Silly Big python…. it’s funny how it embarrasses the perl.

  • burt

    I have a copy of “Python Programming” by John Zelle
    The most important part of the book is hidden in Appendix B and half of the programs in the book will not run. Is it the Python or the book?

  • flamoot

    It’s the book

  • PythonHater

    Python is terrible, you shouldn’t promote it, it is impossible to read and overall very lame, stick to language which at least follow common sense when implementing the syntax.

  • Someguy

    Perl > Python by far. It has much better documentation and is more common sense in my opinion.

  • Joe Krahn

    There is no explanation here as to why Python sucks. The main problem with Python is that changes in whitespace can change the function. Having a language that enforces indentation is OK, but Python depends on precise alignment across many lines of code. Also, an indentation always counts as one indentation level, no matter what the size, but a dedent can be any number of dedents, depending on the previous lines of code. It works OK for small bits of code, but larger programs get really ugly. A folding or Python-aware text editor helps, but it is still a language weakness. It makes about as much sense as Fortran77 indentation rules.

    Perl has it’s own problems. Object oriented features are a hack, and even well-formatted code can look rather cryptic. The documentation is much better just because it has been around much longer than Python. It is also much faster, probably for the same reason.

    I would rather use something less cryptic than Perl, but without the fragile and annoying indentation rules of Python. Ruby looks promising, but I have not used it much yet.

  • http://storybookproperties.com matt

    I thought I was smart and pretty decent at programming until I spent the last several days, surrounded by books, trying to learn python. Don’t get me wrong, I could easily entertain a 6-year old with my IDLE interpreter antics. I’ve even built a GUI and blah blah blah. But there is an anoying “spin” (read: lie) about the “ease of Python.” Here are the significant issues (from the standpoint of a business owner who just wants a robust and very quick solution to web and desktop applications):
    1- There is virtually no documentation. This whole thread began with someone saying they couldn’t find documentation and that is the crucial problem. For those of you who disagree, look in the mirror–you’re taking for granted how much you know. And for the rest of us, it’s very very difficult to find a simple requirement like, what are the arguments i need to pass to a simple function?
    2- Data Typing is not handled eloquently. It seems to be transparent at first, but unclear data types in python have led me to some very difficult to debug code (even when I seemed to explicitly type my variables).
    3- Python has no GUI. Oh I know you’re going to blog that there are dozens of them from Tkinter to Qt to Wx etc. But those have crappy documentation, no matter how powerful they are. I managed to crank out a few GUI’s, but just the GUI itself took days on what would have taken less than 20 minutes in Visual Studio. (Don’t misunderstand, I despise MS World- But if you value your time as much as your money, it makes sense to use VS. I’ve already spent more on the API Python Wing and unhelpful Python books than I would have spent just buying Visual Studio outright).
    4- Python is not free. You’ll spend a gazillion hours trying to figure out some documentation that would have simply popped up on the screen in VS. And the books. I’ve personally put Mark Lutz’s kids thru school with his Python books. And the web tutorials are well-intended but, for my level worthless. And don’t go off thinking I’m some lame beginner. I’ve created several very successful businesses and programmed much of the software that keeps them running at a high level.
    5- Python is not intuitive. Sure you can write some apparently readable code at the interpreter. But take a bird’s eye view of some fairly simple code in the basic python modules…there’s nothing remotely readable about it. My dog can do some amusing tricks but I wouldn’t let him drive my car.

  • she

    python is horrible because:

    - whitespace matters:
    no programming language that runs on NASA software should ever EVER EVER care about significant whitespace to satisfy a parser’s need
    - def __this_stinks__(blabla,blablablablabla):
    horrible horrible horrible.
    - wrong OOP. When Alan Kay said OOP he not only did not mean C++, but also did not mean Python

  • Just a Developer

    Joe Krahn said:
    > Perl has it’s own problems. Object oriented features are a hack,
    > and even well-formatted code can look rather cryptic. The
    > documentation is much better just because it has been around
    > much longer than Python. It is also much faster, probably for the same reason.

    1. Perl is not faster, either not produce smaller code, if you want get
    things right. Well, with Perl actually you can produce smaller sources
    by GZIP’int em all, and most important that readability of the source
    after compressing won’t change that much… :-)

    2. Perl also has lack of exception handling. There are Error module,
    which is basically a hack and workaround, which does not catches
    properly lot of things. Well, even trivial things, like division by zero.

    3. Perl’s built-in regular expression support is significantly different
    that what most other languages provide. It makes Perl very powerful
    tool while parsing text documents. However, this is very strong
    disadvantage of Perl with none of counterweighting advantages while
    working with XML (which is NOT a text!) and other complex data structures.

    4. Standard library in Perl is absent, strictly saying. The rest is in CPAN.
    To maintain such system, in some cases turns to be nightmare at
    commercial production.

    In short, the place of this rubbish lister is in museum. Perl6 is vaporware
    and Python/Ruby, both of them beats Perl at Unix SA field these days.

    > I would rather use something less cryptic than Perl, but without the fragile
    > and annoying indentation rules of Python.
    Python idents aren’t that fragile. They could be annoying, but using
    correct editor and writing in correct way, Python is fine.

    Maybe you want to read this nice posting:
    http://www.secnetix.de/~olli/Python/block_indentation.hawk

  • Pingback: What people said about Python sucks « Rudimentary Art of Programming & Development

  • http://webcoder.info/ Brianary

    @Just a Developer:

    1. If you say so. There are differing posts about this online, and I’d wager that the two are at about the same order of magnitude in terms of speed, in general.
    2. Wrong.

      eval {
        ....
      };
    
      if ($@) {
        if ($@->isa('MyFileException')) {  # Specific exception handler
          ....
        }
        else { # Generic exception handler
          ....
        }
      }
    

    3. Examples, please? I don’t believe this is true. For the most part, other languages copy Perl. Who had RegEx first?
    4. There is a standard library, depending on the distro of Perl you use. And maintaining CPAN modules is only a nightmare if you frighten easily. ;) There’s a whole module for easy module maintenance (CPAN). I imagine that this is something Python programmers will claim is a liability until PyPAN is ready.

    I haven’t used Perl for serious programming in years, but when I need to quickly rename a bunch of files, massage some data, &c., Perl is indispensable.

    I like Python’s indent-blocks. That’s part of what has drawn me to learn it, but I am also runnning into the lack of documentation, and it could cause me to walk away. Don’t dismiss Perl docs with “ok, the extra documentation is mostly centered around perl’s terminally weird syntax and stupid implicit argument behavior.”, because that’s just stupid and subjective. Read some Perl docs and see if that’s really the case. In fact, pick 20 common features and compare the docs to Python’s, and see what I mean. pydoc is nice, and I really like the local web server feature, but there’s just no CONTENT there.

    The thing that is really throwing me is that there is no easy way to do something as simple as parsing an RFC 1123 or RFC 822 datetime value, which are used in email/MIME, HTTP, RSS, &c. This is a BIG hole. When people complain about the fact that strptime ignores timezones, Guido himself just points the finger at C, as if that’s an acceptable excuse. If you can’t parse a standard date format, fixing that should be a top priority.

    Also, what’s up with repr() vs. str()? That’s bizarre.

  • thatguy

    Since when did Python not have enough documentation? There’s a giant tutorial directly on the Python website..

  • http://happybobblog.blogspot.com/ Scott Wimer

    I came here via ‘pydoc sucks’.

    I wrote a validation helper library from some Django code I was working on, dutifully writing doc strings for each helper and a docstring header.

    When I try to view it with pydoc though, it barfs because it can’t find a django module that my library uses.

    I don’t want my doc viewer to execute my code; I want it to extract and format documentation.

    If your code writes to a file in the top level, then reading its docs via pydoc will create, or delete, or whatever files. That’s really suboptimal.

  • madwifi

    python doesn’t suck, but it’s horrible

  • ron_paulite

    Python is slow.

    Whenever somebody says Python is slow, Python fans would say that Python, being an interpreted language, will always be slower than compiled languages. Or they would say Python is fast enough

    The PROBLEM is Python is slower than PHP.

    Just go to any Python website and you will know.

    An example is:
    http://www2.ljworld.com/
    And this site is created by the creators of Django!

    And it is not just this Python site that is slow. There are many many Python sites which are very slow. And please don’t say that it could be the web hosting or the server which is slow — because when so many Python sites are slower than PHP sites, it couldn’t be the web hosting.

    Also, Zope/Plone is even slower.

    Python is slow. Very slow.

    Sure, Python is definitely a more advanced and powerful language than PHP. But what’s the point if it is slow. And contrary to what Python fans like to say, Python is not an easy language to program in. And it is definitely not easier to write Python web applications as compared to PHP.

    Python sucks. Python is slow.

  • http://code.google.com/p/gray-matter/ Raj

    Python rules and Perl drools.

    Also, Vim rules and EMACS drools.

    Discuss. ;-)

  • Torsten Bronger

    There are lies, damn lies, and benchmarks.

    And the worst benchmark all is a person just browsing the Web and listening to his “feeling”.

    The *serious* benchmarks other people did show that — of course — Python has the same speed than PHP whithin the error span. Most even see an advantage for Python.

    BTW, those Web framework benchmarks are really superfluous. Unless one framework is not one order of magnitude slower than the others — and none of the significant is — it’s simply unimportant. Look at the hype with Rails although it *is* slowest until we get the YARV in the upcoming Ruby release.

  • http://stuvel.eu/ Sybren

    Well, if you can’t even find http://docs.python.org/ nor http://www.python.org/doc/, you surely lack the skills to judge any programming language.

  • http://anonymous.com anonymous

    Dear ron_paulite,

    Python is not slower than php. It is the other way around.

    http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=python&lang2=php

    Click there and you will see in almost all tests, php lags heavily behind python.

    It is also faster than perl.

    http://shootout.alioth.debian.org/u32/benchmark.php?test=all&lang=python&lang2=perl

  • mike

    http://ipython.scipy.org/moin/

    At the interactive prompt you can type ? and it will spit out what the function does, along with many other cool tricks.

  • http://mike mike

    oops that should say “function_name”? didn’t realize it would hide the angle bracketed text

  • Tom

    Python is better than all other languages.
    The reason? Its fast enough for me to mess around with and its easy enough to learn (or grasp).

    I have made a python program that generates Fractals (Wikipedia it) and writes them to a .png file, complete with colours. It took me an hour to make, with messing around.
    Its cool, but a bit low rez (With 100×100 pixels it would be). So, I made it draw 1000×1000 pixels, but it was a bit slow. So I added threads workers from the Thread linked with the Queue module that took in x and y co-ordinates, ran some clever math functions and spat out a colour, then drew a pixel on that x,y co-ordinate. Its a bit faster, so I imported Psyco and .full()’ed it, which sped it up about 3 times.

    The point? I couldnt have done any of that without Python docs.

  • Doug

    I can write perl in my sleep. I’m just learning python. Somehow I found this. Python whitespace is mostly a non issue. Not better. Not worse. Different. For myself, I like to put temporary debug print statements flush left…guess I’ll have to change that habit with Python. Ok, that does suck. But in case you haven’t figured it out by now, ALL PROGRAMMING LANGUAGES SUCK(tm). Perl, Python. They suck equally, in different ways. Now get back to work.

  • http://php.net Andy

    Well Python rocks :)

    Windows runs on Python. I am sad that the developers of Blender selected such an un-professional language which is both non standard, and unfriendly to a programmer. Do you expect an artist to be using PYTHON ? are you listening BLENDER MORONS ? You should have sticked to C++ (minus the MS shit .NET).

    PHP is a great language and is so much friendly, need a a day of training to even the worst of morons to understand the Perl and C++ borrowed syntax.

    Anyone who accuses perl if favor of PYTHON, you should get your facts straight. A languange for even a novice has to be forgiving, and yet remain graceful which PHP does generations ahead from any PYTHON ASS’s thoughts.

    OOPS, My Foot, we never use it when not required. PERIOD. A simpe form submission does need a .NET component shit. it just needs 5 lines of code than struggling around Apache to get this Python shit requiring all ports open(AKA PLONE).

    good luck guys, rant all from your hear against python, I love 3D Toools, but will never forgive the original coder who shose python as an API, he was surely insane or incapable on c++ or even PErl.

  • Kilroy

    Yes, Python is a very powerful language BUT it is also very slow!
    And I am not comparing it with C or other compiled language or statically typed language. Python is also slow compared to other dynamically typed interpretive languages.

    It is okay for PHP and ASP to be slow because PHP and ASP do not claim to be powerful or advanced languages and they are easy to learn. But Python claims to be an advanced language. Advanced and yet so slow????

  • http://smxlang.org doc

    i like perl’s implicit arguments. they reflect what i actually do with my code… like, you know, read from the list of arguments to the program. or, say, do something with a list variable. try doing this in python and it will lokk like some reverse polish meltdown. for(@x){s/(http:.*)/urlencode($1)/eg}

  • http://trimbo.blogspot.com Trimbo

    I love that I typed in “Python Sucks” and your blog came up first.

    LOL.

  • Python3kFTW

    Honestly, anyone who accuses Python of lacking documentation or readability is entirely off their tree. Python has:
    – Docstrings (access them via help(object) or help() and type the name in)
    – docs.python.org, which uses the excellent Sphinx documentation tool
    – Most modules come with a readme (although this is common to *just about every* language, people often overlook it)
    – Crunchy (http://code.google.com/p/crunchy/) which makes online tutorials ‘come alive’, so to speak, by embedding an interpreter in the browser

    Python even has it’s own version of CPAN, the Python Package Index (PyPI, http://pypi.python.org/pypi) with an absolutely huge listing of packages.

    And comparing Django and PHP is ridiculous as Django is a framework, PHP is not. This probably explains “anonymous”‘s comment.

    The one point I have to agree on is that Python is *S.L.O.W*, and although you can increase it’s speed quite easily (Psyco, Cython, C Extensions, Stackless Python (which is an incredible implementation), etc) and bring it up to scratch.

    On whitespace: Yes, Python does use a HUGE amount of whitespace, but as “Just a Developer” pointed out, it’s not all necessary and does drastically increase the readability of your code. Someone tell me this is not criptic: for(@x){s/(http:.*)/urlencode($1)/eg} and this is the problem you will always face with people who don’t know the language they are talking about (and I am no exception, I don’t know ANY Perl)

    ~sigh~

  • Andrei

    I’m a programmer with 13+ years experience in web and desktop applications, and I use Python on occasions (not for the language itself, but for some applications written in Python).

    I don’t recall seeing a programming language more hectic that Python. It looks like an April’s Fool joke that caught on with the public, like a hack that people just don’t let go.

    I spent a few days reading some books about it and I got pretty good with it, but in many parts I consider it a hack. You want some examples, I assume:
    – lists: add an item: append/insert method; get+remove an item: pop method (strange name matching)
    – lists: add an item: append/insert method; remove an item: del STATEMENT (that’s right, not a method, but a statement)
    – lists: add an item: append/insert method; get the size: len FUNCTION (that’s right, not a method, but a standalone function)
    – iterate over items: for dicts use the iteritems method, for lists use the enumerate function
    – and many others.

    I like programming languages which are either brief, or well designed (so that you can “guess” how API calls will look like before you read about them, by extrapolating your previous experience in that language). Python is none of that. Moreover, IMHO it’s widespread use in Linux’s desktop apps is even hurting Linux’s image as a good desktop OS.

    Now the good part: I like Python’s whitespaces matter approach. Again, it has some design problems, but it’s nice.

  • aMoLk

    No problem with whitespaces. I have been programming for 10+ years and I like my code to look neat. I use whitespaces/tabs anyway whenever I’m writing programs, whether its HTML or TCL or Shell or anything else. So, I like a language where I can leverage my whitespacing skill ;)

  • http://www.facebook.com/profile.php?id=1218524780 Doug Hancox

    Python’s most critical flaw is the fact that it can’t export ANYTHING as an EXE. And the only way to do so is to essentially trick the program into doing it for you by finding a third party installation app and hoping it takes the bait.

    Fuck this programming language.

  • JoeyJoe

    That is EXACTLY why Python sucks. You nailed it.

  • JoeyJoe

    And what’s with all this 2.x versus 3.x crap? Make up your minds people! Where is this language going?

  • Pvdmeer

    Python isn’t fast. But I think it’s fast enough. I’ve been a long-time user of Perl. Perl is sloppy by default. Python isn’t, and still it’s possible to do a quick five-line experiment without the pain. I think Python is a slow version of Perl (including the awesome amounts of modules), but way more tidy and suited for developing somewhat bigger apps. For developing off-line scientific tools, it’s the weapon of choice (because of the speed of the numpy vector operations). And if you hate a language for it not being able to not make a binary then, you sir, have never heard of package managers. Also, I made apps with Java, and the development process was excruciatingly slow, same for C++ with its gazillion features which all bear caveats. Python is a productive language. And btw, the Python documentation is actually pretty good and widely available. Maybe in 2003 it wasn’t, I don’t know.

  • Spaminator

    Not everyone uses Windows. File extensions are meaningless. Microsoft’s version of the Python platform is called .Net. Your compiled .Net “EXE” applications can’t run without installing a massive library. If you would prefer stand-alone applications then you can use an appropriate language such as C++ or Haskell. Have a nice day. :)

  • Theindianmc

    Dude, Perl is way slower than Python.

  • Theindianmc

    It depends. Which code doesn’t work?

  • Theindianmc

    yo, dont hate, and please dont discriminate, cuz if u do ill come after u, and make u eat my poo.

    LOL

  • Guest

    Python sure does suck.  WHen you do find docs, they’re of the form presented at the truly awful docs.python.org – no simple examples and a truly dreadful interface.  But Python it’s a vacuum cleaner next to Perl’s black hole of suckiness!  I know it’s been said, but Perl is write-only.  Time for it to die a lonely, neglected death.
    And I have to say that this comment box sucks beyond the scope of either of the above.  It doesn’t scroll in Firefox. 

  • Guest

    Docs.python.org is about the least most helpful documentation I’ve ever read.  Want a simple example of something? Go elsewhere.  If Sphinx is the tool responsible for the awful (the index doesn’t scroll with the page – wfh?), the Sphinx is _not_ an excellent documentation tool.Where I do agree, though, is that Perl is truly, direly, appallingly awful.  Oh, and I do (or did) know Perl.

  • Guest

    ROFL!

    1. Perl is not faster, either not produce smaller code, if you want get

    things right. Well, with Perl actually you can produce smaller sources

    by GZIP’int em all, and most important that readability of the source

    after compressing won’t change that much… :-)