Slashdot Mirror


Beginning Python: From Novice to Professional

nazarijo writes "Python seems to be devouring everything these days, with more and more people using it for serious projects. It's quickly supplanting Perl in some circles, and with good reason. It's a powerful, richly featured language with boatloads of extensions. And, unlike Perl, it's very easy to do complicated things in simple, legible code. Python books are still only a small part of the shelf at your local bookstore when you compare it to the popularity of Perl, but which ones are the gems and which ones are fluff? Having looked at a lot of Python books in the past couple of years, I think that Beginning Python: From Novice to Professional is the one that I'll most recommend to people." Read on for the rest of Jose's review. Beginning Python: From Novice to Professional author Magnus Lie Hetland pages 604 publisher Apress rating 8/10 reviewer Jose Nazario ISBN 159059519X summary Tour the Python language, from basics to advanced modules

Beginning Python is loosely grouped into three main sections. The first deals with Python fundamentals, all the goodies that are inherent to the language and the modules that it ships with. It's surprising to see how rich the language is out of the box, especially when compared to some other scripting languages. The second section would be the chapters covering popular extensions for a variety of services. These include network and web programming, SQL objects, and even GUI programming. And finally the third section is a set of 10 projects in Python, which bring everything together in a concise fashion.

I like this book a lot because it is very clear in its delivery, both the prose and the code examples used, and is consistently Pythonic. The Python language lends itself to a powerful programming style and, unlike Perl, many Python developers I know don't bother with a dozen ways to perform a simple action, they get it done and move on. What you wind up with is clear code that's easily understood by someone new to the language.

Unlike what the title would suggest, Beginning Python isn't only for the first few weeks with the language. The book is large and in depth, and the coverage of material is fantastic in many ways. You get a quick tour of the basics and then you move on to an overview of the language and then its common features. The inclusion of the 10 projects is another benefit to the intermediate user. She can refer back to this book for additional information and pointers from time to time, it wont sit still on her shelf.

That said, there are a few things in the book that I tend to disagree with. For example, the author dissuades you from using destructors in your code, but in my experience they're far more reliable, and a better place to do some cleanup, than he states. A few chapters are also a bit skimpy when they didn't need to be. For example, Chapter 18, which covers packagers like the distutils component from Python, needed to be fleshed out a lot more. This is a powerful feature in Python and sound docs on it should just be there. There's no reason to hold back on something so vital. The section on profiling in Chapter 16 is also a bit thin around the middle when it needn't be. While this seems like a minor point, having a reference to speeding up code (and measuring the improvements) is always nice. And finally, Chapter 17, which covers extending Python, is simply too short for its own good. A more in depth example would have been appreciated.

I have begun recommending this book to people I know that are smart and program in other languages, but aren't very familiar with Python. Many beginners books only take a person so far before they become a useless item on the shelf. This means that he $30 or more that was spent is now gone, so I've grown to be observant of how long I expect a book to be useful. I anticipate the useful shelf life of Beginning Python will be longer than average for most general purpose programming books for a single language. What's more is that it's not a dry reference book. Couple this to a Python cookbook for recipes and you have a two volume "mastering Python" series.

If you've been curious to learn Python and haven't yet found the book that speaks to you clearly, this may be the one. I'm pleased with the quality of the writing, the examples, and the quick pace of the book. While it's nearly 30 chapters in length, most of them are short and focused, making them easily digestible and highly useful. Overall probably the best Python books I've had the good fortune of reading."

You can purchase Beginning Python: From Novice to Professional from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

73 of 436 comments (clear)

  1. free python tutorial from book author by chriss · · Score: 5, Informative

    Not only is this a good book, it is also one of only few that cover Python 2.4. The author Magnus Lie Hetland has a free python tutorial ("minimal crash course) (Instant python) on his homepage. He was also involved (as author, editor etc.) in several other book projects:

    So we can assume he has a clue what he is writing about.

    His homepage uses PHP, btw.

    Chriss

    --
    memomo.net - brush up your German, French, Spanish or Italian - online and free

    1. Re:free python tutorial from book author by dmeranda · · Score: 3, Informative

      Python Cookbook, Edition 2 also covers version 2.4. And it is also a very useful book, even for those who know Python quite well...you can always learn a few new tricks.

      http://www.oreilly.com/catalog/pythoncook2/

  2. being python by joe+155 · · Score: 2, Funny

    we are the knights who say Ni!
    Oh, sorry, wrong python

    --
    *''I can't believe it's not a hyperlink.''
    1. Re:being python by masklinn · · Score: 2, Informative

      Not by far much, and Monthy Python based jokes are higly valued in Python the community and appreciated in python code/comments.

      --
      "The way we can tell it's C# instead of Haskell is because it's nine lines instead of two." -- wadler
    2. Re:being python by Zencyde · · Score: 2, Informative

      One of the programs associated with Python is called Idle (used for typing code and then running without any compiling, good for quick tests), this name comes from Eric Idle, who was on the cast of Monty Python.

      --
      What day is it? Could you please tell me?
    3. Re:being python by 19thNervousBreakdown · · Score: 2, Funny

      I knew there was a reason I didn't like Python.

      --
      <xml><I><am><so><damn>Web 2.0</damn></so></am></I></xml>
    4. Re:being python by Ksevio · · Score: 2, Informative

      The language was actually named that because of Monty Python so that's not far off: http://python.org/doc/faq/general.html#why-is-it-c alled-python

  3. Totally fresh in programming by Nichotin · · Score: 4, Interesting

    I hope this is not modded off topic. Here goes:

    I am probably not the smartest person in the world, and I have no programming experience what so ever. What I am looking for, is some easy language to either script or program. Would python provide a good starting environment? Have any of you been at my level, then learned python?
    I have tried to do as much research as possible myself, but it seems that everyone I ask just woke up one morning, and found themselves to be able to program three or more languages (in other words, they do not remember how they started out). I have also tried to learn several languages by reading some O'Reilly books and similar, but I have been put off by the seemingly academic english that is used (my native language is norwegian, by the way).

    If anyone have any recommendation, as tho where to start, I would be more than happy.

    1. Re:Totally fresh in programming by LionKimbro · · Score: 2, Insightful

      I have tried to do as much research as possible myself, but it seems that everyone I ask just woke up one morning, and found themselves to be able to program three or more languages (in other words, they do not remember how they started out).

      Ha!

      Insightful.

      Yes, yes, true.

      I skilled up when young, by typing in programs from the back of Family Computing.

      I don't know what to tell "kids these days."

      Entering computer programs, by hand, worked well for me.

    2. Re:Totally fresh in programming by Colonel+Panic · · Score: 4, Informative

      I would check out How To Program by Chris Pine. It's very much for people who have no programming experience.

      Also, for a very different, novel and fun approach you should check out Why's Poignant Guide to Ruby . Did I mention it was fun? It's also a great intro for someone who has never programmed before.

    3. Re:Totally fresh in programming by Just+Some+Guy · · Score: 5, Informative
      What I am looking for, is some easy language to either script or program. Would python provide a good starting environment?

      Absolutely! I think it's one of (if not the) best languages for new programmers. My main reasons are:

      • It has a very simple syntax.
      • The core language is relatively tiny - there aren't many keywords that you have to learn just to get started.
      • It is strongly, dynamically typed, which means that you can spend more effort on telling your program what to do rather than the nitpicky details of how to do it.

      Opinions will vary, of course, but I think that Python is an excellent choice to start with.

      Have any of you been at my level, then learned python?

      Nope. When I was at your level, I had to learn a lot of really awful languages because the average person didn't have access to the nice ones. I would have loved having something so easy to learn and powerfully expressive at the same time.

      --
      Dewey, what part of this looks like authorities should be involved?
    4. Re:Totally fresh in programming by JTorres176 · · Score: 2, Informative

      Python was the very first language I used to learn to program. I had multiple people telling me to start with python, so I perused over to their site, picked up a few online tutorials to go through, and started building a library of python books.

      It helps because I can write one program for Linux, it works on my Windows PC with minor mods, and even works on my wife's Palm with similiar minor mods.

      Python is a platform independant object-oriented programming language. It's great to learn, and it's great to start your learning with.

      --
      Evil Walrus >83=
    5. Re:Totally fresh in programming by Rei · · Score: 4, Informative

      Actually, yes, I would definitely recommend it. I started programming before Python (actually started in Basic because it was the only thing I had in 7th grade, then ran as quickly as I could away from it to a real language). However, python is a very easy language to learn and you don't need to deal with any advanced concepts to "make things work".

        * You don't have to declare variables
        * Code blocks are simply based on how you indent, making it always very legible
        * You can easily see what functions are available in a package using dir(), and you can get brief help information on a function by print function.__doc__, from within any python shell.
        * Very simple to do things that might take a long time to in lower-level languages - reading contents of files, splitting strings, performing regular expression matches, etc.
        * Performance is tolerable for most applications - just don't try to write Quake or physics calculation software in it.

      --
      The *special* hell.
    6. Re:Totally fresh in programming by engagebot · · Score: 3, Insightful

      Also interesting to note that many universities start students programming in C. The reason they do is because they want computer science students to get a good understand alot of what's going on in the background, not just learning a specific language.

      The kicker: If you understand the principles behind it, you can easily learn any language.

      You probably want to skip alot of the theory behind data structures and whatnot at the beginning though.

      --
      Han shot first.
    7. Re:Totally fresh in programming by gabe824 · · Score: 4, Informative

      My first language was C, learned in a first year university introductory programming course, but when friends have asked me about learning programming I have recommended they start with python and the book How to Think Like a Computer Scientist: Learning with Python http://www.ibiblio.org/obp/thinkCSpy/. Its available free online. This is a good introductory book with no expectation of prior experience that teaches the ideas behind programming, not just the syntax of the language.

    8. Re:Totally fresh in programming by Just+Some+Guy · · Score: 3, Insightful
      if you have to modify it, even a little, every time you port it to a new operating system, you can hardly call it "platform independent".

      Out of curiosity, what other language qualifies as platform independent by your definition? Answer: there isn't one. In the context of what we currently have, today, in 2006, Python is just about as platform independent as anything else.

      --
      Dewey, what part of this looks like authorities should be involved?
    9. Re:Totally fresh in programming by T.i.m · · Score: 2, Interesting

      Two years or so ago I made a CS master thesis where I tried to find / create the perfect language and IDE for learning to program. I did a pretty thoroug study of what is available and what is desired in such an environment. And i came to the conclusion that Python is very close to a perfect place to start learning programming.

      I starred to make som tweas in the environment and the language but "Unfortunatley" I got a job right after I finished so I didn't have time to finish the projec. In case someone is interested, more information and a manhandle beta can be found at:

      http://www.gahnstrom.se/tim/pystarter/

      Tim

      --
      Question authorities
    10. Re:Totally fresh in programming by CoderBob · · Score: 2, Informative
      Like some have mentioned, Python is a great place to start learning. It's platform indpendent (point #1), object-oriented (point #2), and not VB or Java (points 3, 4, 5, 6, and 7.)

      My hatred of Java and VB aside, however, I would add this: Once you get a good grasp of how to program in Python, it would be time to cut your teeth on a lower-level language. C or C++ would work here. It's going to be a little rough, as you get used to the different requirements, but you'll learn a lot more about Comp Sci.

      Also, and this could possibly go before you learned C or C++, you may wish to take a look at design patterns once you get the basics down. Addison Wesley has an excellent book on patterns here (No, there is no referer BS in the link) which I encourage you to look at.

    11. Re:Totally fresh in programming by bcrowell · · Score: 2, Insightful
      And i came to the conclusion that Python is very close to a perfect place to start learning programming.
      I've used python as a language to teach people programming (in the context of a physics course, to do numerical simulations). It was OK, but the significance of whitespace was a major barrier for them to overcome. If I was doing it over again today, I'd probably use Lua, which has a very standard C-like syntax. Another consideration is that it might be good to use a language that's small enough to run in a web browser.

      Python's strengths, AFAICT, are its pure object-oriented design and the large set of libraries available for it. IMO, neither of these are particularly important for teaching beginners to program.

    12. Re:Totally fresh in programming by Jason+Earl · · Score: 5, Informative

      For the most part Python software written on one platform will work just fine on any platform with Python installed. Python is completely portable in that manner, and official Python interpreters are available for a ridiculously wide array of platforms. However, if you don't take that portability into account when you start writing your software it is pretty easy to write bits that won't work when you move them to a platform with significant differences. For example, Python has APIs that deal intelligently with the various path separators, line endings, etc. that folks that write software for various platforms deal with every day. However, it's fairly easy to ignore these tools and do things like hardcode 'c:\MyDirectory\' into your application.

      It is also possible to write Python software that uses third party Python extensions written in C or C++ that haven't been ported everywhere. Of course, this is possible in every "platform independent" language that I have heard of. It's certainly possible to do this with Java (witness IBM's SWT).

    13. Re:Totally fresh in programming by Baricom · · Score: 2, Interesting

      I know many others are going to cringe at this, but I would suggest starting with PHP. It's not traditionally taught as a first language, but I think it has some positive qualities that might make it useful.

      First, PHP shares much of its syntax with other popular languages today. It looks a lot like C*, Perl, Java, and JavaScript. The control structures, many of the operators, and other parts of the language are all remarkably similar. In my opinion, this will reduce your learning curve as you tradition to other languages.

      Second, PHP is ubiquitous immediately applicable. You can find it installed on almost any web server, and in a variety of other places. It is designed around being used to create web pages, but it's also rich enough to use it as a general-purpose scripting language without much trouble. Additionally, the core functions take care of many details you may not want to deal with right away, but it gets out of your way if you want to dig deeper into how everything works.

      For what it's worth, my learning path as a programmer was GW-BASIC to QBasic to Visual Basic to Perl. I started in elementary school by typing in programs from old children's books. I picked up OOP concepts from Visual Basic. Today, I do most of my programming in PHP, but I have a passing familiarity with Perl and to a lesser extent, Python.

      I know a lot of languages, but none very well :)

      The ability to do basic (no pun intended) programming is incredibly liberating. Good luck!

    14. Re:Totally fresh in programming by Just+Some+Guy · · Score: 2, Insightful
      I like (good) static typing precisely because it saves me effort

      Many of us - both beginners and not-so-beginners - like dynamic typing for the exact opposite reason: things that would be errors in statically typed languages are perfectly acceptable in dynamic language. Implicit, pervasive polymorphism can let you create some very robust code in a relatively short amount of time. Writing "foo_int", "foo_string", "foo_float", etc. gets a little old, even if it does give you some explicit guarantees about the data you're manipulating.

      --
      Dewey, what part of this looks like authorities should be involved?
    15. Re:Totally fresh in programming by Jason+Earl · · Score: 2, Interesting

      The funny thing about cross-platform applications is that, until you have done a few, it is easy to make mistakes. This is especially true if the software in question is not entirely self-contained. Heck, Windows even has different file handling abilities than most other systems. In the real world these issues are thorny enough that most people don't really bother. After all, most applications only end up running on one architecture. In fact, most applications only end up running on a handful of machines. Python is easy enough to use that you quickly find yourself writing scripts that are not only custom to your machine, but customized to the way that you like to work. For example, I have a set of scripts that I wrote for altering the HTML versions of baen.com's ebooks so that they make slightly nicer plucker ebooks. Next thing I knew I had a script that logs into my account using my username and password, downloads all of the new books I have purchased, mangles them, and formats them as plucker ebooks. It then checks to see if there are any new free ebooks on baen's site and downloads and formats them as well. Lastly, it updates of list of "books to read" so that I can know which books are new and which books I have already read.

      Clearly, I am not the least bit interested in making sure that particular piece of software is portable. Why should I? I know perfectly well that for the forseeable future my home desktop will be a Linux box. I chose Python (over Java which I use professionally) because I knew that Python would get the job done in less time. HTTP transfers, zip files, HTML mangling, etc. are all things that Python does extremely well with a minimum of fuss.

      Basically, I use Python because it is fun. The fact that I can easily write portable software is part of what makes Python fun (it makes what can be a difficult job painless and easy), but it is only a part of what makes Python fun enough that I use it to mangle ebooks instead of mangling them by hand.

    16. Re:Totally fresh in programming by GalacticCmdr · · Score: 3, Interesting
      * You don't have to declare variables
      * Code blocks are simply based on how you indent, making it always very legible
      These are the two very reasons I dislike python. It is far to easy to have a typo cause problems in the use of a variable. Since you do not have to declare variables if you want striker, but instead fatkey in an increment to strikr then it becomes a problem that can be difficult to find.

      Second, any language that requires indenting to signify code blocks is in my mind a great step backwards to the days of Fortran. This makes code blocking too vulnerable to pretty printers and version control methods that may "adjust" indentation.
      --
      Programming: Its not just a job - its an indenture.
    17. Re:Totally fresh in programming by Rei · · Score: 3, Insightful

      then it becomes a problem that can be difficult to find

      Only if you already have a variable called 'strikr'. Otherwise, you'll get a runtime exception. Not having to initialize variables is completely different from "all variables come pre-initialized to some value". If you type "a=b", b better be defined. It doesn't have to be *declared* (nor does a), but it must contain a meaningful value (which could be None - python has a concept of null).

      vulnerable to pretty printers

      Who would run some random code formatter on their code when it's not designed for their language? That's just idiocy. Even still, if it treats "4 spaces" in one place as the same as "4 spaces" in another, the code will still work - python just cares that you're *consistant* with your indentation. Meanwhile, with C/C++, you can shove the brackets almost anywhere and do the most bizarre indentation imaginable, and it's perfectly content with you - bad form.

      --
      The *special* hell.
    18. Re:Totally fresh in programming by Just+Some+Guy · · Score: 2, Informative
      Ummm, Dude? Python is not strongly typed.

      Ummm, Dude, yes it does.

      Guido seemed to be discussing dynamic versus static typing, not weak vs. strong.

      --
      Dewey, what part of this looks like authorities should be involved?
    19. Re:Totally fresh in programming by Coryoth · · Score: 2
      counter = 1
      while counter < 10:
          do something...
          couner = counter +1
      in a statically typed language that is picked up at compile time. in a dynamically typed language you won't notice it until your app hangs at runtime and you'd better hope your in a situation where you can easilly attatch a debugger.

      In some ways the confusion here arises from the fact that static types had benefits in optimization, and hence were necessary information for the compiler to parse correctly. At the same time static types are used as a means of checking (to a certain extent) the correctness of code. Because the compiler ends up doing the correctness checking because it needs to sort out the types it has become common to conflate compilation and static error checking into a single task, when really they are two quite separate tasks. What am I getting at here? That compiling or interpreting a program isn't really how you should be checking for correctness - it's nice but hardly necessary. If you ran python static correctness checking tool pychecker (which tries to statically catch many common errors) over that code it would throw a warning that "couner" was set but never used, happily catching the typo/spelling error. In fact if statically checking your code is important you'll find pychecker will catch a great many common errors for you.

      Now as to the separation of static checking and compilation - if you're willing to see that static checking is a separate task and devote tools to just doing that then you can do a whole lot better than just static types. Check out JML which, by adding extra annotations beyond just static type annotation, allows you to use far more powerful static checking like ESC/Java2 which makes standard static type checking via javac look as poor at catching errors as a dynamically typed language.

      Jedidiah.
    20. Re:Totally fresh in programming by Just+Some+Guy · · Score: 2, Insightful
      Python is portable, too. But it's still possible to write non-portable code, such as Windows programs that call COM objects, or Unix programs that create device nodes.

      Basically, if you stick with the core modules and don't hardcode pathnames or do other bad things, then your programs will be portable. Venture past that, just as with any other language, and all bets are off.

      --
      Dewey, what part of this looks like authorities should be involved?
  4. Devouring? by MosesJones · · Score: 5, Informative

    Python seems to be devouring everything these days... even replacing Perl

    From Dice.com

    Python : 545 matches
    Perl: 3809
    C#: 3850

    Ummm over 1/8 of the demand of Perl or C#

    Java: 11856

    Java+BEA: 621

    So Python is smaller than one specific application servers development requirements.

    Python is better than Perl, but in terms of devouring? Its like saying that American Football is devouring other sports around the world.

    --
    An Eye for an Eye will make the whole world blind - Gandhi
    1. Re:Devouring? by GigsVT · · Score: 4, Insightful

      That's not a good measurement.

      Those are unfilled jobs. Jobs that they couldn't find someone for without resorting to advertising. In other words, the jobs that get listed on job sites are the ones that no one wants.

      --
      I've had enough abrasive sigs. Kittens are cute and fuzzy.
    2. Re:Devouring? by Reality+Master+101 · · Score: 4, Interesting
      Just to make another useless-but-interesting experiment, I tried the following: Google for:
      "written in python": 665,000 hits
      "written in perl": 1,140,000 hits
      "written in c": 1,500,000 hits
      "written in c++": 772,000 hits
      "written in c#": 342,000 hits
      "written in java": 1,750,000 hits
      "written in haskell": 33,600 hits
      "written in lisp": 61,400 hits
      "written in pascal": 51,800 hits
      "written in objective c": 26,800 hits
      "written in ruby": 120,000 hits

      I'm not sure what this measures, but it's interesting. :) Python actually did a lot better than I expected.

      --
      Sometimes it's best to just let stupid people be stupid.
    3. Re:Devouring? by Decaff · · Score: 5, Insightful

      Python is better than Perl, but in terms of devouring? Its like saying that American Football is devouring other sports around the world.

      You are forgetting that this is the Slashdot Universe, where...

      "Java/Intel/Oracle/Sun/Windows is dying..."

      "No-one uses commercial UNIX..."

      "Open Source is GPL and anything else is evil.."

      "PHP scales for everything...."

      and...

      "Favourite open-source language [fill in the blank] is the future and everyone is already using it...."

      When in this Slashdot dimension, you have to understand the rules!

    4. Re:Devouring? by smallpaul · · Score: 2, Insightful

      Job descriptions trail language popularity because they are driven by the need to replace people who were working on pre-existing projects. If every programmer decided to day to switch to Intercal, that wouldn't seriously show up in the job postings until a few years from now when the code needs to be maintained.

    5. Re:Devouring? by killermookie · · Score: 3, Interesting

      "written in php": 2,190,000 hits

    6. Re:Devouring? by belmolis · · Score: 2, Interesting

      Here are the current Freshmeat statistics. The numbers are the number of projects in the specified programming language. I've omitted those with fewer than 10 projects. They probably give a fairly good idea of the popularity of programming languages if you take into account the bias toward the Free Software world. In the MS Windows world Visual Basic, for example, would no doubt rank much higher. Also note that these are cumulative over the past 6 years or so.

      C 7863
      Java 4567
      C++ 4077
      Perl 3569
      PHP 3529
      Python 2234
      Unix Shell 852
      JavaScript 634
      SQL 475
      Tcl 455
      Objective C 321
      Ruby 289
      Assembly 238
      C# 217
      Scheme 127
      PL/SQL 88
      Delphi 83
      Lisp 83
      Fortran 69
      OCaml 63
      Ada 62
      Common Lisp 60
      Emacs-Lisp 60
      Haskell 58
      Pascal 56
      Awk 46
      Zope 46
      ASP 40
      Visual Basic 37
      Eiffel 33
      ML 32
      Basic 31
      Smalltalk 31
      YACC 30
      Cold Fusion 27
      Forth 24
      Lua 23
      Erlang 21
      Object Pascal 20
      Prolog 20
      Pike 14
      Rexx 13
      Modula 10

      For the scripting languages, Perl and PHP lead, followed by Python, then Javascript, then Tcl. Ruby still isn't that popular on Freshmeat, and Lua, REXX and Pike hardly register.

    7. Re:Devouring? by Naum · · Score: 2, Interesting

      "written in COBOL": 43,100
      "written in REXX": 809
      "written in CLIST": 168
      "written in scheme": 34,900
      "written in RPG": 700
      "written in FORTH": 10,900
      "written in objective-c": 26,700
      "written in WFL": 5
      "written in tcl": 106,000
      "written in bash": 24,000
      "written in korn": 480
      "written in smalltalk": 20,400

      And finally...
      "written in curses": 40

      --

      AZspot
  5. On a related note... by Just+Some+Guy · · Score: 2, Informative
    For a quicker introduction to the language, you might look at the article I wrote for Free Software Magazine. It's not an in-depth analysis by any means, but should get you acquainted with the basics in under 10 minutes.

    It's licensed under the Creative Commons "Attribution-Share-alike" License, so feel free to pass it around if you want to.

    --
    Dewey, what part of this looks like authorities should be involved?
  6. O, yeah? by Anonymous Coward · · Score: 3, Insightful

    "And, unlike Perl, it's very easy to do complicated things in simple, legible code."

    Perhaps it is time for you to get a perl book or take CS-101 course or something.

    1. Re:O, yeah? by Just+Some+Guy · · Score: 4, Insightful
      "And, unlike Perl, it's very easy to do complicated things in simple, legible code."

      Perhaps it is time for you to get a perl book or take CS-101 course or something.

      I've got both. So, tell me: what's the syntax for returning multiple complex objects from a function in such a way that they don't have to be dereferenced by the calling code (that is, they can be used directly, just like you were returning a single scalar)?

      Python example from the interactive shell:

      >>> def foo():
      . return {'one': 'ein', 'two': 'zwei'}, lambda x: x + 5, str
      >>> a, b, c = foo()
      >>> a['two']
      'zwei'
      >>> b(5)
      10
      >>> print c.__doc__
      str(object) -> string

      Return a nice string representation of the object.
      If the argument is a string, the return value is the same object.

      I'm not overly stupid, but doing something so relatively easy in Perl put me at my limits. I like Perl, and I've written many large programs in it, but I always had to fight against the syntax. Python got out of the way and let me concentrate on logic instead.

      --
      Dewey, what part of this looks like authorities should be involved?
    2. Re:O, yeah? by Coryoth · · Score: 2, Insightful

      "And, unlike Perl, it's very easy to do complicated things in simple, legible code."

      Perhaps it is time for you to get a perl book or take CS-101 course or something.


      It is, I quite agree, entirely possible to write fairly simple clear legible code in perl. It does require a few extra hoops, but in general it isn't that hard, it just requires a fair bit of self-discipline or, if you're working in a team, some very rigid well defined coding standards ... that everyone sticks to. From my point of view, if you're at the point of bothering to have and enforce coding standards, why not just enforce them at the language level? The compiler/interpreter can then tell you whether you're meeting appropriate standards, and does a much better job of ensuring everyone actually conforms to a consistent interpretation of the standards. In effect that's what Python does to a certain extent (and you can also find it in other languages like Eiffel and Ada). I perfectly understand that such strict and required enforcement isn't always necessary or desireable - not every software project has maintainability and legibility of code as a primary concern, and if you're just coding by yourself obviously you'll always meet your own standards - but if you are serious about maintainability then, to my mind, language enforced coding standards and a certain amount of "one right way to do it" has real value.

      Jedidiah.

    3. Re:O, yeah? by chromatic · · Score: 3, Insightful
      ... if you're at the point of bothering to have and enforce coding standards, why not just enforce them at the language level?

      Because the language designer probably doesn't know as much about your team and the problems you're trying to solve as you do.

    4. Re:O, yeah? by Parity · · Score: 4, Insightful

      That's a really foolish argument. Of course you have to make references and dereference to do the same thing in perl, because perl is a pass by value language; python is a pass by reference language.

      In perl you have to be explicit to dereference.

      In python you have to be explicit to copy.

      Your case happens to be one where references are needed, and in python, implicit. In cases where copying of arrays is need, python needs to be explicit; perl is implicit. So ignoring the ridiculous 'without dereferencing' restriction:

      sub foo {
        return { 'one' => 'ein', 'two' => 'zwei' }, sub { my $x = shift; return $x + 5; }, "string"
      }

      my ($a, $b, $c) = foo();

      print $a->{'one'};
      print $b->(5);
      print $c;

      --
      --Parity
      'Card carrying' member of the EFF.
    5. Re:O, yeah? by Just+Some+Guy · · Score: 2, Interesting
      The reason that drove me nuts, though, is that you had to handle objects returned from a function differently than objects you created in the same scope:
      my ($a, $b, $c) = foo();
      print $a->{'one'};

      my %d = ('one' => 'ein', 'two' => 'zwei');
      print $d{'two'}

      Of course, you could always deference $a into another variable and access it that way instead, but that's the sort of "throwing extra code at it" that I meant.

      I'm not saying Perl is bad. A lot of people use it to do lots of things. For me, though, the warts eventually overwhelmed the pearls and I went looking elsewhere.

      --
      Dewey, what part of this looks like authorities should be involved?
  7. Re:Civilization IV is Python and XML by AuMatar · · Score: 2, Informative

    No it isn't. The AI scripts are. THe engine is C++.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  8. Has to bash on Perl by Anonymous Coward · · Score: 2, Insightful
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    This must mean you aren't able to write legible Perl code. Perl has been making complicated things simple for more than a decade. If you don't know how to write clean code, then your Python will also suck.

    1. Re:Has to bash on Perl by Myddrin · · Score: 5, Insightful

      And, unlike Perl, it's very easy to do complicated things in simple, legible code.

      This must mean you aren't able to write legible Perl code. Perl has been making complicated things simple for more than a decade. If you don't know how to write clean code, then your Python will also suck.

      Not directed at the parent, but at the Perl-snipping in the original post....

      <RANT>

      I'm a professional python programmer, and I've been making my living at it for a number of years now. (It was my embracing of python that allowed me to transition to a 100% MS free workspace.) I started using it a project a few years ago, and it's just stuck for a number of reasons. (meta-classes, extensibility, etc.)

      One thing that drives me buggy about some python evangelists, (and many evangelists, in general) is the need to bash anything that is not their favorite brand (be it Creative vs iPOD, Python vs (insert any language here). And so on. The fact of the matter is that Perl is a perfectly good language. I don't use it on a regular basis personally, but I've seen, read and understood a good deal of Perl code w/o a hassle. (yes, I've seen some scary code, but I've seen scary code in C++, Python, Java, etc., etc., etc.)

      Sometimes we just have to admit that there are multiple good tools that we could use, but we have a personal (and possibly irrational) preference for one over the other. That's life as a human being (which I'm assuming at least 99% of the readers out there are. :) ). Just because some people use Perl, doesn't make my choice of python (of C++, my other "main" language) any less valid.

      It's real life, not a multiple choice test -- there is no single "correct" answer.

      </RANT>

      Ok, I'm done... back to work.

      --
      Myddrin
  9. Re:Damn perl bashing by Metasquares · · Score: 4, Informative

    It is a bit harder to be legible in Perl than in other languages, to be fair, especially if you use regexps (but then, they're not all that legible anyway to begin with). Still, you get used to it after a while and it becomes as easy to read Perl as any other language.

  10. the obligatory Python vs Perl post by hashmap · · Score: 5, Funny

    EXTERIOR: DAGOBAH--DAY

    With Yoda strapped to his back, Luke climbs up one of the many thick vines that grow in the swamp until he reaches the Dagobah statistics lab. Panting heavily, he continues his exercises--grepping, installing new packages, logging in as root, and writing replacements for two-year-old shell scripts in Python.

    YODA: Code! Yes. A programmer's strength flows from code maintainability. But beware of Perl. Terse syntax... more than one way to do it... default variables. The dark side of code maintainability are they. Easily they flow, quick to join you when code you write. If once you start down the dark path, forever will it dominate your destiny, consume you it will.

    LUKE: Is Perl better than Python?

    YODA: No... no... no. Quicker, easier, more seductive.

    LUKE: But how will I know why Python is better than Perl?

    YODA: You will know. When your code you try to read six months from now.

    1. Re:the obligatory Python vs Perl post by ExoticMandibles · · Score: 2, Informative
      Thanks for reposting that. No thanks for removing the attribution--I wrote that, back in 1999. And I have proof.

      larry

  11. Simple, Legible Code by AthenianGadfly · · Score: 5, Insightful

    And, unlike Perl, it's very easy to do complicated things in simple, legible code

    The issue with Perl isn't that it's particularly hard to do complicated things with simple, legible code (not more so than a lot of other languages, anyway), but that it's very, very easy to do something extremely quickly, which often - but not always - means code that makes sense at the time but isn't necessarily readable, or leads to overly terse code. Yes, Perl makes it easy to do things wrong (and a lot of people out there do use Perl to make unreadable programs), but that doesn't mean that it can't be used to do things correctly as well as any other language.

    1. Re:Simple, Legible Code by lawpoop · · Score: 2, Interesting

      In Perl, it is easy to make legible code, and it is easy to make illegible code.

      In Python, it is easy to make legible code, but it is difficult to make illegible code.

      I would argue that this fact makes it harder to write legible code in perl than in python.

      --
      Computers are useless. They can only give you answers.
      -- Pablo Picasso
  12. Dive into Python by Jazzer_Techie · · Score: 4, Informative

    No discussion of Python literature can be complete without mentioning Mark Pilgrim's Dive into Python, which is an excellent way to get to know the Python language. It's free for download in a variety of formats. Two caveats however, being that 1) it hasn't been updated in about a year and a half and 2) it assumes that you already have a pretty good grasp of programming in some other language. But if you've you got some coding experience and want to take a serious look at what Python has to offer, this is a great book full of nice examples (with the code available for download as well).

  13. python regexes by funkelectric · · Score: 2, Insightful

    After hacking perl for over 10 years, Python sounds very good. The first program I tried to write in Python was the quick-and-dirty thing I need most: Read a file and parse it using regexes. Perhaps I stumbled upon the one area where Perl shines in comparison with Python, for that is the impression I got. The Python regex methods do not seem a natural fit for the problem.

    1. Re:python regexes by Just+Some+Guy · · Score: 2, Informative
      What part of Python's regexps did you not like? The main difference I was was that instead of:
      if ($var =~ /some?pattern*/) { foo }
      you'd write something like
      if re.search('some?pattern*', var): foo
      or if you're doing the same match many times:
      pattern = re.compile('some?pattern*')
      if pattern.search(var): foo
      (kind of like Perl's "/o" once-only modifier).

      So, the calling convention is slightly different - one is procedural, and one is OO - but Python uses Perl's regexp engine so the patterns themselves should be identical.

      --
      Dewey, what part of this looks like authorities should be involved?
  14. Python? Why not Ruby (on Rails)? Because ... by chriss · · Score: 5, Informative

    Since this is inevitable to pop up, a very simplyfied version (slightly offtopic):

    Why not ditch Python and use Ruby (on Rails)?

    • Ruby is a nice language. It looks more like Java (or C or Perl) than Python, so that may be an advantage for those who dislike Pythons whitespace handling (I think it is genius)
    • Rails is a very nice framework for developing database driven web-apps very fast
    • Someone (David Heinemeier Hansson) really cared to make this user/developer friendly. There is good marketing, nice screencasts (although basically smoke and mirrors), good documentation, a well structured central web site, lots of support. All this may be even more important than the technical differences to other platforms like Python.
    • It's hype, so you could easily sell it to management

    Why better stick with Python?

    • Most of the hyped features Rails are available on Python too, although not yet in such a nice package. The Turbogears folks try this, but in a more pythoniac way. I like it better, since they actually bundled already established products like CherryPy and SQLObject instead of simply writing from scratch. This may not result in a smooth package like RoR, but it is more clearly aimed at the integration of other products.
    • There are tons of modules and documentation for Python out there. So if you come to the point where you want to include other features than those already present in your framework, it will be easier to add them from different sources, because a) there are more and b) integration is a more established process.
    • There has been a lot going on in the RoR aftershock to improve the situation, like discussions about merging the different frameworks (Turbogears/Subway) to create a unified and very powerful platform.
    • There is always a way up in Python with Zope (although this is a beast and documentation is bad, 3.X is much better, but lots of products currently still require 2.X) and integration in J2EE.
    • Python is old. There has not only been one generation of developers whos projects failed, but many. RoR is still in the "early adaptors" phase, where everyone sees the revolution and casualties are accepted. Ruby alone has had a strong following in Japan, but for the rest of the world Rails was the first contact. Wait a year until the "RoR sucks" postings appear, than you'll be much wiser.

    Chriss

    --
    memomo.net - brush up your German, French, Spanish or Italian - online and free

  15. Re:Civilization IV is Python and XML by Zathrus · · Score: 4, Informative

    No it isn't. The engine and the AI are written in C++. All of the game scripts (map generation for example) and interface is in python, all the game data is in XML, and it's highly modable.

    The AI can be reprogrammed in C++ using their API. See Question 6. I'm not positive that it's been released yet though.

  16. Re:Before too many people post please read this! by warewolfe · · Score: 3, Informative

    I've had good experiences with O'Reilly in general, and with "Learning *", "Programming *", and "* Cookbook", where * has been Python, Perl, PHP. However, have a look at http://python.oreilly.com/ and download the free chapters and source code before you buy. For an intermediate level programmer you can probably do without the "Learning Python" book. Good Luck.

    --
    Then again, I could be wrong.
  17. Learning Python by kevin_conaway · · Score: 2, Informative

    I am a Java programmer by profession but I wanted to give Python a shot because it seemed like fun.

    As a programmer experienced with OO programming and some other types of "scripting" languages, all I needed to read was Learning Python from O'Reilly. Great book, great language.

    On a shameless side note, if you're a Scrabble fan, come check out my online, multiplayer Scrabble program written in Python. PyScrabble

  18. python isn't just for web apps by jbellis · · Score: 2, Insightful

    For various reasons (more mature stdandard & third party libraries; English docs; real threading support -- this is a big one; etc) Python is a much better general-purpose language than Ruby.

    (It's also about twice as fast, but honestly if Ruby is too slow for your project a factor of 2 probably isn't going to save you. Still, speed is a nice bonus.)

    1. Re:python isn't just for web apps by jaydonnell · · Score: 2, Informative

      yes and no. I use python and ruby at work and I prefer ruby as a language. Python does have better support and more mature libraries and it's a very nice language. We have a mix of linux and windows and python has much better windows support which is why we still use it as much as we do. The docs issue is weird. Ruby doesn't have as many docs, but I feel the docs they do have are often better (this is probably just personal preference). The python docs have left me wanting many many times. They are there for sure, but they can be really lacking.

      Also, python does not have real threading support. It has the GIL which will prevent your threaded python app from using more than one processor, but it's still better than ruby's thread support. I don't think this is much of an issue for two reasons.
      First, a lot of threaded apps are threaded because they are waiting on io of some sort usually network io. Ruby and python both work perfectly well for this type of threading need.
      Second, I've only ever done one project that needed to be multithreaded so it's a non factor for me and I think most people are in the same boat.

  19. A few good and free Python books by YA_Python_dev · · Score: 3, Informative
    On the python.org site you can find a big list of Python books.

    I suggest:

    Good reading.

    --
    There's a hidden treasure in Python 3.x: __prepare__()
  20. most helpful book by engagebot · · Score: 2, Insightful

    I think the book thats most helpful to the novice programmer wouldn't be a book about any language at all.

    It'd be a book about programming and algorithms in general. Its MUCH easier to root around in a 'hello world' program or the like if you understand things like loops, if/then/else statments, function calls, etc. Even the fundamental idea of declaring and using a variable.

    --
    Han shot first.
  21. -1 Troll for Submitter by toupsie · · Score: 2, Insightful
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    So can Perl.

    --
    Strange women lying in ponds distributing swords is no basis for a system of government.
  22. Python is for architects - Perl is for lumberjacks by mrfoos · · Score: 2, Insightful

    Comparing to two for me is like comparing tree cutting with building houses.

    When you build a house you need an architect and specific design rules so other people in the project can do their part. It takes a long time to build it, and someone has to live in the house a long time.

    When you cut down a tree you're only interested in the fastest way possible to get it down safely. Who cares if it's pretty. If you didn't like the way the first one fell, you can make adjustments on the next.

    A house builder wouldn't tell a woodcutter which axe to use. He doesn't care. Of course, woodcutters have no business building houses.

    Personally? I like being a lumberjack. Nothing like fervorishly hacking away and yelling "TIMBER!" from a safe distance.

  23. Re:My 2 scents by Anonymous Coward · · Score: 2, Insightful

    Run "pychecker" on your python scripts. It catches all sorts of things; certainly almost anything having to do with misspelling.

  24. I started with Perl by PerlPunk · · Score: 2, Informative

    Since the start of the review is basically a flame against Perl, I can't resist making a plug for it--especially since it was the first serious programming language that I learned.

    If a programming language is sufficiently powerful, you won't become proficient in it overnight. For myself, I went through three stages: tutorial, hobby, profession.

    It started with me back in 1999 when I wanted to learn HTML, and so I set out to learn it. But in the mean time, a friend of mine in the business told me that with Perl you could pretty much do anything you want in making web applications. At the time, I didn't know the difference between server-side and client-side scripting, and I figured, why not give it a try?

    So I searched on the internet and found Robert's Perl Tutorial. The introduction says, "It assumes that the reader knows nothing of programming whatsoever. . ." On reading it, I knew this was for me. So, eventually I found out I had to download Perl, which I did, and then I started going through the tutorial. URL: http://www.sthomas.net/oldpages/roberts-perl-tutor ial.htm

    Going through the tutorial took me two or three weeks. After finishing it, I decided to try to make my nascient website cooler than it was by adding some server-side scripting. Now that I wasn't just in the tutorial anymore, I had to learn something about CGI. That's when I found the site "CGI Programming 101", http://www.cgi101.com/class/ (I'm pleased it is still around, too.) From this I learned the rudiments of CGI programming with Perl.

    From this, I wrote a program called Article Master, which, had I stuck with developing it, could have been *the* killer-app blogging software instead of MovableType. (I'm sure there are probably 50,000 other geeks out there who also started out with something like this, discontinued development on it, and are still kicking themselves in the butt for missing out on coming out with the killer app.) In any case, after building the software and getting it to work kind of OK, I developed a deployment package for it and submitted it to an online Perl script archive. After submitting it, the archive gave me a free email address and access to the exclusive programming forums. The site sent me an email telling me I got these exclusive benefits because I was a programmer.

    I had never thought of myself as a programmer, but here was a site brimming with programmers telling me I was one of them. It was such a positive boost for me that it encouraged me further to develop my skills.

    Soon enough, I bought the Perl CD Bookshelf from O'Reily. Now, I had all the information and reference material I needed to write almost anything I wanted. I did some other personal online projects, and then, somehow I got the idea to try out getting a job using Perl. (This was at the beginning of 2000, just before the dot-com bust, so the entrance bar was set pretty low.) I called up a head-hunting agency and asked them if they needed someone who knew Perl. The agent on the other side said, "Get down here ASAP!" I went, I took their computerized test, and the results made him do backflips. (Hey, I knew what JAPH meant, and that was a question on the test!) He said he would have no problem getting me into a job, which he did. (And the money was more than I had ever dreamed of making.)

    When I started, I got an assignment (all CGI development) from one of the other lead programmers, and he asked me how long the job might take me. I hesitated, and just before I was about to say "a few days", he asked if I could do this in a few hours. I said, "Yeah, OK." I asked him if there was an HTML tool they used, and I just got this blank stare. I learned quickly that real Perl programmers don't use HTML editors--like our Perl code, we type everything else by hand. I somehow rose to the occaision and got the job done in time. From t

  25. Re:Perl vs. Python by JoaquinFerrero · · Score: 3, Informative
    Why? You can write Perl & Python together:
    #!/usr/bin/perl

    use Inline Python => <<'END_OF_PYTHON_CODE';
    def add(x,y):
    return x + y

    def subtract(x,y):
    return x - y

    END_OF_PYTHON_CODE

    print "9 + 16 = ", add(9, 16), "\n";
    print "9 - 16 = ", subtract(9, 16), "\n";
  26. Python Riddles by AlXtreme · · Score: 2, Interesting
    Recently came across pythonchallenge, it's a notpron/riddle site for learning Python, with each riddle requiring more and more code. Great idea, imho.

    As if python itself wasn't fun enough :)

    --
    This sig is intentionally left blank
  27. yeah! OO stinks in perl by McKing · · Score: 2, Informative

    Objects!

    Perl == horrible bolted-on afterthought OO

    Python == *much* better (real objects, finally!)

    Ruby == pure heaven, everything is an object and iterable by default.

    I was bored one day at home and recreated a class in ruby that I wrote at work in perl. Took me all day to do something in perl that it took about 1/2 an hour to do in ruby, and I added a couple of features as well. I also spent way more time looking up how to do stuff in perl that in ruby, event though I've programmed off and on in perl for years (a decade, in fact)....

    --
    If only "common" sense was actually that common...
  28. Python is a straightjacket by Tony · · Score: 3, Insightful

    In Perl, it is easy to make legible code, and it is easy to make illegible code.

    In Python, it is easy to make legible code, but it is difficult to make illegible code.


    That's because Perl is versatile, flexible. Python forces you to do things The Python Way(tm). I've tried Python a couple of times, and I keep going back to Perl. Maybe I'm just a rebel, but I don't like a language telling *me* what to do (queue "In Soviet Russia..." joke here).

    And, yes, I mostly just hate the whitespace-as-blocking braindamage. It's like Guido loved LISP, but hated the braces, so he re-invented LISP, poorly. But that's why I love programming-- everybody gets to choose their favorite poison.

    --
    Microsoft is to software what Budweiser is to beer.
  29. Re:Damn perl bashing by pileated · · Score: 3, Insightful

    I don't think that it's harder at all to be legible in perl. It's just that unfortunately perl culture encourages illegibility. A great book that doesn't is Damian Conway's recent Perl: Best Practices. What a breath of fresh air to see someone say that perl ought to be legible. Sad to say I think that the things that brought perl to it's early prominence are also the things that have hurt it in the long run: the ability to do something complicated extremely quickly. Unfortunately this seems to have encouraged "clever" programmers, who use every clever perl trick in the book. All that cleverness has become part of perl culture.

    Oddly enough I'm reading a book on Applescript right now (not because I really want to but because I need to write some fairly complicated scripts in it.) The book reminds me of perl in it's early days when it says how easy it is to do something or how Applescript magically does something for you, like understand whether you're in a string or math context. This seems good to beginners. But it the long run I think if lends itself to muddled code. There's just a little too much congratulations to each language for it's cleverness (and perl definitely is clever).

    As far as Python goes god knows I tried to read either Programming or Learning Python but I just gave up. It just didn't hold my interest at all. Give me Java, or legible Perl any day!

  30. Language Discipline by Tony · · Score: 2, Interesting

    . . . but if you are serious about maintainability then, to my mind, language enforced coding standards and a certain amount of "one right way to do it" has real value.

    Perhaps for you.

    "Maintainability" is undefined for this problem set. I can't maintain Python code because I fucking despise the language, for the same reason I don't like anal uptight bastards in three-piece suits -- it's inflexible. There's only one way of doing things, and often it is not be best way in specific situations.

    For me, it always comes back to blocking. Whitespace-as-blocking is a straightjacket, chosen for aesthetics, and not for any practical reason. This design philosophy permeates Python, making it one of the ugliest languages I know.

    It's like music. Any number of corporate-whore bands create smooth, aesthetic music that is bland and boring. I like my music hard, with sharp edges and dangerous points. For me, Python has always been the N*Sync of the programming world (VB is like New Kids On The Block, fwiw). Perl is more like the Pixies. LISP is like the Beatles. C is like the Stones. FORTH is like Gus' first album. Assembly is like the Black Keys. Java is like Abba.

    Huh. This is kinda fun.

    Now you can tell me about how programming is engineering, and not art. Go on, I know you want to.

    --
    Microsoft is to software what Budweiser is to beer.
  31. Artical summary blows it again. by Hosiah · · Score: 3, Insightful
    And, unlike Perl, it's very easy to do complicated things in simple, legible code.

    I just burned through the flamewall on this issue not three days ago. I use Python instead of Perl, love Python best of all languages currently, and may even like the book reviewed. But it is superstitiously ignorant to declare any language makes it "easier" to program in. Can we just once have a discussion of the strengths and weaknesses and merits and demerits of any language at all, instead of talking about it like it was a laxative? "Makes the code soft and it flows out smoothly!" No, it doesn't: nothing does; hard programs are hard to write, easy programs are easy to write. I'll even save the time and copy my closing argument from last time:

    I know a secret. It's a secret you only find out after programming for a while. It's one you obviously don't know if you ask me which programming language is the "easiest".

    There is this public perception, unanimous in user-land, and even permeating to the very depths of Slashdot, which goes: "Computers are only hard because evil computer programmers deliberately set out to make them hard." And the secret is: that that's a falsehood. Computers are not made artificially difficult. It does no good to tell you this; this is a special kind of secret that you can only learn through experience.

    The experience of struggling to design a usable user interface for your own system. The struggle to overcome the barriers of closed systems, lack of documentation, and misinformation everywhere you turn. The exasperation of dealing with users who come to you with the attitude that your program broke on purpose, you should fix it without knowing what the error was, and it's too hard to learn anyway because you make it difficult, because you're "evil".

    Programming experience erases that mental line drawn between user and programmer. You get experience on both sides of the fence, and eventually you see that there is no such thing as artificial complication. Interfacing with a machine upon which we have taught electricity to think and where we hope to make it sing and dance for us is inherently complicated TO START WITH, and the various tools we use to perform our tasks - why, each and every one was written by average people like you and me who also sat down with a clean file and furrowed their brow and wondered "How can I do this? How can I make it so people will use it?"

    No, you still have that mental mindset that there are programmers who deliberatly design things to be difficult, that it's all in spite, that they're laughing at you. Who, except as a joke, would deliberately make a programming language "hard to learn"? To fail at your task and blame your tool is simply a form of denial so that you don't have to face the fact that you have given up on trying to use something (no matter if it's COBOL or Javascript or Perl or freaking TECO, even!) that hundreds of other people have used successfully.

    There is no "easy". There is no "hard". There is only "Task".

    Now, you want to talk about an "easy" language? Binary, of course! Binary has just two commands (one and zero) so it's the fastest to learn, has cross-platform compatibility built-in (all computers know binary!), is easiest to test (no compiler or interpretter required, just "Rite 'n' Run"!), is readily available everwhere (ALL programs are "open source" in binary!), and needs no extension libraries (Binary can do it all!). If you thought this paragraph was stupid, this is how stupid the rest of you sound to me when you hyperfocus on "easy" and act like there's no other aspect to programming.