Slashdot Mirror


The Python Paradox, by Paul Graham

GnuVince writes "Paul Graham has posted a new article to his website that he called "The Python Paradox" which refines the statements he made in "Great Hackers" about Python programmers being better hackers than Java programmers. He basically says that since Python is not the kind of language that lands you a job like Java, those who learn it seek more than simply financial benefits, they seek better tools. Very interesting read."

29 of 726 comments (clear)

  1. Re:FP by nyssa · · Score: 2, Informative
    print "First Post" # is more appropriate
  2. Python in the workplace by jobeus · · Score: 3, Informative

    Interestingly enough, knowing Python did get me a job... My company works a lot with Java too, but my job specifically deals with about 90% Python, and 10% Java... I never thought there was a use for it when I learned it in University...

    Too bad I'm maintaining code with two letter variable names all the time though, and now it's soured the language for me as well... heh.

  3. Re:The way source code looks by r.jimenezz · · Score: 5, Informative
    Mmm...

    for( SomeType s : collection )
    doSomething( s );

    I think something along those lines is already possible in Java :)

    --
    The revolution will not be televised.
  4. Python jobs - got resumes? by otisg · · Score: 3, Informative

    Who says Python is not good for getting jobs? I know at least 2 places in New York City where you should send your resume, if you are a good Python hacker: http://www.wirelessgeneration.com/ and http://www.divmod.org/ (also .com).

    --
    Simpy
  5. Re:The way source code looks by tcopeland · · Score: 2, Informative

    > for( SomeType s : collection )
    > doSomething( s );

    Yup, JDK 1.5 (or 5.0?) will introduce generics, enumerations, and a for-each construct - as soon as it gets out of beta.

    But it'll be about four years you'll be able to actually use them because it'll take that long for folks to move off of JDK 1.4 :-)

  6. Re:That's all well and good... by Theatetus · · Score: 2, Informative
    so long as he buys my theory that lisp hackers are better than python hackers.

    Ummm.... something tells me Paul Graham would agree with that. Read his Lisp books some time.

    --
    All's true that is mistrusted
  7. Re:The way source code looks by Anonymous Coward · · Score: 3, Informative

    Sure, with these toy examples...

    But the thing to keep in mind is, the Ruby version is just a method on the collection, it is NOT a language construct. You can write your own like this:

    # do it in a random order
    collection.each_random { |x| x.do_something }

    # do it to every other item
    collection.each_even { |x| ... }

    # show a busy cursor during the operation
    collection.each_with_busy_cursor { |x| ... }

    You really don't realize the power of Ruby until you start coding BEYOND what you can already do in other languages.

    And if you play with Lisp, the *whole language* is fluid like this. For instance in a lisp program I needed to slow down a sequence of operations by sleeping in between. I wrote a macro that took a block of code and inserted (sleep 1) between every operation:

    (sleep-between 1
    (foo)
    (bar)
    (baz))

    How do you even begin to do this kind of stuff in, e.g., VB?

  8. Re:Java programmer's viewpoint by SkeptiNerd75 · · Score: 2, Informative
    Until there is an IDE for Python that's as extensive, capable and sophisticated as Eclipse I'm going to stay with Java.


    Actually, you can use Eclipse as an IDE for Python: http://www.python.org/cgi-bin/moinmoin/EclipsePyth onIntegration.

    And why choose between Java and Python when you can have both?

  9. Re:Yea by Inf0phreak · · Score: 2, Informative
    Then I think Unlambda or Whitespace would be better choices.

    Brainf**k is a relatively simple stack based language. The only thing about it that makes it hard to understand is its very terse syntax. Unlambda and Whitespace has this as well, and in addition to this they are completely unreadable. The reasons are quite different though: Unlambda because there is absolutely nothing like it (wrapping your mind around a myriad of s's, k's, i's and `'s == pain. I've tried) and Whitespace is just impossible to read (and program for that matter) without the aid of a program that can convert it to something where you can actually tell the instructions apart.)

    --
    ________
    Entranced by anime since late summer 2001 and loving it ^_^
  10. Re:The way source code looks by ArsonSmith · · Score: 2, Informative


    foreach ( @collection ) {
    $_->DoSomething();
    }

    --
    Paying taxes to buy civilization is like paying a hooker to buy love.
  11. Re:Python is great for guys like me.... by perdu · · Score: 2, Informative
    I guess the point I'm making is that this language has a strong appeal to people like myself who are just looking to use it to solve problems and/or make problem solving tools
    Thanks for the thought!

    We have a bioinformatics group where I work and Python is the language of choice when they need to crunch alot of numbers. I understand there is a nice interface to the R statistical engine and many other useful facilities. I've never gotten any of them interested in Java which we use for our systems in IT...

    --
    You only use 2% of your DNA
  12. Re:Source? by kjd · · Score: 4, Informative

    Google turned this up, which cites a source: http://www.mindview.net/WebLog/log-0037

  13. Re:Source? by Anonymous Coward · · Score: 1, Informative

    From Googling:

    This study is mentioned in this book excerpt and here.

    The first reviewer here mentions a reference that would seek to discredit the cited study's author however.

  14. Re:Python vs Java by chez69 · · Score: 2, Informative

    I don't have to install anything in my classpath to use standard java classes.

    --
    PHP is the solution of choice for relaying mysql errors to web users.
  15. Consistency is another great thing about Ruby by jesterzog · · Score: 2, Informative

    That example seems a bit selective to me. Code blocks are nice given the rest of the way that Ruby is designed to make them useful and handy, but I don't think it's necessarily superior. Personally I'm a great fan of Ruby for it's consistency, which I suppose it inherited from Smalltalk. I really like being able to deal with anything in the same way, without having to worry that there might be exceptions.

    I've been using Python as my favourite scripting language for several years -- it's a neat language to code in. Recently though, I had a situation where I wanted to make adjustments to the String metaclass, and I hit a brick wall. Python's consistent in most places, and getting even moreso over time, but there are some bits of it that completely conflict with everything else. If you hit one of them it can be quite frustrating.

    Switching to try the same thing in Ruby, I found that the consistency between standard library classes and everything else made it so much easier. In my Python version, I had to design a wrapper around a string, which is very yucky because I really want all strings to act a certain way - not just those that I remember to put a wrapper around. With Ruby it was just a matter of re-declaring the String and adding the methods I wanted.

  16. Re:Python is great for guys like me.... by kndyer · · Score: 2, Informative
    I agree completely, With its support for numerical analysis (and similarities with Matlab-y constructs) it is ideal for algorithm prototyping and in some cases even algorithm deployment.

    I certainly turn to Python first, rather than coding up new ideas in c++.

  17. Re:Java programmer's viewpoint by mschaef · · Score: 2, Informative

    "Java is now frequently used in CS research as well. It looks almost certain that the next milestone in CS evolution will come in the form of Aspect Oriented Programming and AspectJ has been the leading implementation. "

    Ironically enough, AspectJ is heavily based on the Lisp/CLOS Metaobject protocol that dates back to the late 80's and early 90's. Not that this should suprise anyone, the same folks developed both tools. I'd characterize AspectJ as more an "industrial response" to CLOS/MOP than new research.

  18. Don't pick on Design Patterns by GoF! by lordpixel · · Score: 2, Informative

    I agree with most everything you say, but I don't think Design Patterns is a good example.

    It weighs in at 395 pages, which isn't the thinnest but way short of the 1000 page plus behemoths you're talking about.

    Most of that page count is actually showing you example implementations (in C++ and SmallTalk). Sure, you could leave those out, but examples are useful when your book is about abstract concepts.

    This book is worth its (light) weight in gold.

    --

    Lord Pixel - The cat who walks through walls
    A little bigger on the inside than out

  19. Re:Why I like Python by razeh · · Score: 2, Informative
    I disagree. Operator overloading is nothing more then syntactic sugar. Code that uses it is no more difficult to read then code that makes ordinary function callls.

    When you see:

    Foo a, b(3), c(5.3);
    a = b + c;

    You will be tempted to assume that addition is occurring. Do not! Treat the above code exactly as if it had been written:

    Foo a, b(3), c(5.3);
    a = b.add(c);

    Or better yet:

    Foo a, b(3), c(5.3);
    a.assign(b.add(c));
    Once you've realized that it's all function calls your frustrations will vanish.
  20. Re:The way source code looks by cliveholloway · · Score: 3, Informative
    Err, two things:
    1. You're not dereferencing the hashref ( $hr->{$_} )
    2. You're not doing what was asked - you're iterating through keys of a hash rather than an array.

    Damn Perl trolls ;-)

    for (@x) { do_something($_); }

    # or even simpler
    do_something($_) for @x;

    cLive ;-)

    --
    -- Trinity in high heels carrying a whip: The donimatrix - there is no spoonerism
  21. Eric Sink's reply by GeorgeMcBay · · Score: 2, Informative
    Eric Sink wrote a reply to the original Graham article that mentioned Python and Java that is worth reading....the gist being that for many companies, the best and brightest hackers might not be the best actual employees.

    From my own work experience, I think he is right (in some situations). There certainly are many great hackers I've worked with whose technical skills I respect but I would never want to work with again. Of course, I've also worked with a lot of great hackers who were also great employees, so it can go either way. But any hiring manager (or any employee for that matter) would be wise to remember that the person's technical skills are only part of a bigger picture.

  22. Maybe, but I'm not sure... by Paradox · · Score: 2, Informative

    Consider that Graham's premiere hack was Yahoo! Stores. It wasn't a huge project in LOC count (PG says this is because it was in Lisp). However, it was big enough that Yahoo! had trouble reimplementing it in more conventional languages (and in the end, actually wrote a simple lisp interpreter to handle part of it).

    Yahoo! Stores wasn't a "small" project by any sense of the word. Maybe the upper boundries of "medium."

    --
    Slashdot. It's Not For Common Sense
  23. Re:Apples and oranges by eli173 · · Score: 2, Informative
    We use a fair amount of reflection, too (which makes debugging all kinds of fun). I'm fairly ignorant of Python, so if it doesn't do a lot of that, it sounds pretty neat. My only complaint is I'd prefer a compiled language, because watching production crash because of a typo is not fun.

    One approach to "compile-time" problems with python is to treat pychecker as your compiler. Basically, it looks for all those typos that C etc catch due to requiring variable declarations, and a whole lot more. Unused local variables included.
    Python doesn't really have private members like C++ does, so a lack of accessor functions doesn't have the same meaning.

    (I can't address the reflection thing; never really learned Java. My thinking went from C to Python... from what I saw, C++ was an incremental improvement (long story there...), Java was another, but Python was a leap from C, much the same way C was a leap from ASM.)

    HTH,

    Eli
  24. Re:He likes Small Is Better, which isn't Java by Frater+219 · · Score: 3, Informative
    My point is this: Graham seems to really like the "small is better" approach, for which interpreted languages really shine.

    Actually, the language that Graham is most associated with is Common Lisp, which is neither a small nor an interpreted language. It is relatively large for a Lisp dialect (much larger than Scheme), and a compiler is part of the specification.

    (I'm not counting Arc, since it doesn't exist yet.)

  25. Re:He likes Small Is Better, which isn't Java by Baki · · Score: 2, Informative

    With IDE's like eclipse, that compile any file on the fly as you save it, there is no more lengthly build process and even with a fast compiled language such as Java you don't have to suffer.

    You save and run the program right away, or in the case of an automatically reloading servlet such as tomcat you don't even run the program: your changed class file is detected and tomcat reloads the class in the running program. IBM websphere takes that concept even further.

    It feels like smalltalk, where you are also changing the program aka image in place without restarting it.

  26. Re:Why I like Python by mvpll · · Score: 2, Informative

    I have objects of type A and B. Both handling strings, A as a single string and B as an array of strings.

    You seem to think that

    A3 = A1+A2
    B3 = B1+B2

    is just as easy for a human to parse as

    A3 = A1.concat(A2)
    B3 = B1.add_element(B2)

    I disagree.

  27. Re:what is PG's fascination with Python? by Piquan · · Score: 2, Informative

    I think that he was griping about the distinction between what you can do with a function, and what you can do with a lambda. In Lisp, you can put whatever you want in a lambda. In Python, you can only have a single expression.

    Example, with _s added to deal with ECODE's idiocy about leading spaces:

    _;; v1, in Lisp:
    _(defun make-spammer (n)
    ___#'(lambda (stream)
    _______(format stream "~A tons of spam!~%" n)))
    _# v1, in Python:
    _def make_spammer (n):
    _____return lambda stream: stream.write('%d tons of spam!\n' % n)
    _;; v2, in Lisp:
    _(defun make-spammer (n)
    ___#'(lambda (stream)
    _______(dotimes (i n)
    _________(format stream "A ton of spam!~%"))))

    As far as I know, you can't write v2 in Python using a lambda.

    Of course, somebody else pointed out that you can create a named function and use it, as in the following example. But that can sometimes be rather inconvenient.

    _# v2, in Python:
    _def make_spammer (n):
    _____def fn (stream):
    _________for i in range(n):
    _____________print "A ton of spam!"
    _____return fn
  28. The dumbest thing I've done... by Anonymous Coward · · Score: 1, Informative

    was to learn python. I used it in my previous job for rapid development (easy interfacing with C, clean code, etc etc) and it did the job. But in the end (looking for a new job) this python experience is pretty much useless... everybody wants .net / .com /.c++ experience and nobody's even heard of python... they thought I was taking the piss... probably would've had a better chance mentioning perl or php.

    Anyway, I hope it's not going to take me a year to learn c++ to the same level I can do python because there are better places I could think of statying in than my parent's basement...

  29. Re:Java programmer's viewpoint by Anonymous Coward · · Score: 1, Informative

    I agree that tool availability is an important reason for selecting Java. Most "XXX vs Java" comparisons tend to assume that one is using some form of simple text editor (e.g. Vi, Notepad) to write code, yet few Java programmers work this way due to the plethora of IDEs (open source and commercial) and specialist editors (e.g. JEdit) that exist. These take a lot of the drudge-work out of Java programming by having:

    1) Systems that automate "boring-to-write" stuff such as RMI/CORBA/etc. classes/stubs, interface implementations, pure virtual method overrides in derived classes, etc.

    2) Refactoring support. This is not merely in the "nice to have" category if you have large amounts of legacy code to maintain and expand.

    3) Integrated debugging facilities which assume that one will be writing distributed, multi-threaded code.

    4) Javadoc integration that makes documenting one's classes a doddle.

    5) Ant and other build script integration.

    6) Automated use of CVS and other version control systems.

    7) Extensible architectures that allow easy integration of third party add-ons.

    8) Context-sensitive on-line help, javadoc searching for information on user-written classes, automatic method parameter prompting, and other stuff that can be a big help when writing code.

    Thus, while a Java listing may seem wordier and more complex than (for example) a Python equivalent, one must consider the fact that (a) most Java programmers won't have to write it all by hand, and (b) they will likely spend a lot less time managing, debugging, and refactoring when working on large projects.

    Note also that those who want to use Python, Lisp, Rexx, Smalltalk or whatever can do so from within Java - alternatively, they can avail themselves of those languages' facilities while maintaining Java-like syntax semantics. Have a look at:

    http://flp.cs.tu-berlin.de/~tolk/vmlanguages.htm l

    for some of the language options available to Java programmers.