Beginning Python: From Novice to Professional 436
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.
free python tutorial from book author (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 [hetland.org]) 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 [hetland.org] uses PHP, btw.
Chriss
--
memomo.net - brush up your German, French, Spanish or Italian - online and free [memomo.net]
Re:free python tutorial from book author (Score:4, Informative)
http://www.oreilly.com/catalog/pythoncook2/ [oreilly.com]
being python (Score:2, Funny)
Oh, sorry, wrong python
Re:being python (Score:3, Informative)
Totally fresh in programming (Score:5, Interesting)
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.
Re:Totally fresh in programming (Score:3, Insightful)
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.
Re:Totally fresh in programming (Score:5, Informative)
Also, for a very different, novel and fun approach you should check out Why's Poignant Guide to Ruby [poignantguide.net]. Did I mention it was fun? It's also a great intro for someone who has never programmed before.
I forgot to add (Score:2)
Re:Totally fresh in programming (Score:5, Informative)
Absolutely! I think it's one of (if not the) best languages for new programmers. My main reasons are:
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.
Re:Totally fresh in programming (Score:2)
"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."
I'm not sure what the first part of this sentence has to do with the second. I like (good) static typing precisely because it saves me effort—I find out about my mistakes at compile time rather than runtime. See Nickle [nickle.org]'s type system for an example of what I like.
Re:Totally fresh in programming (Score:3, Insightful)
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
Re:Totally fresh in programming (Score:3, Informative)
Ummm, Dude, yes [wikipedia.org] it [diveintopython.org] does [artima.com].
Guido seemed to be discussing dynamic versus static typing, not weak vs. strong.
Re:Totally fresh in programming (Score:2, Informative)
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 grea
Re:Totally fresh in programming (Score:4, Insightful)
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.
Re:Totally fresh in programming (Score:2)
Re:Totally fresh in programming (Score:2)
Re:Totally fresh in programming (Score:2)
Re:Totally fresh in programming (Score:3, Insightful)
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.
Re:Totally fresh in programming (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).
Re:Totally fresh in programming (Score:2)
I agree, it is absurd to think that platform independence is the only reason why somebody would ever want to use a language that supports it. Such languages often have other desirable features as well.
Re:Totally fresh in programming (Score:3, 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 machin
Re:Totally fresh in programming (Score:5, Informative)
* 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.
Re:Totally fresh in programming (Score:2)
IMHO this is a very bad thing for a beginner (or anyone really). I don't know how many hours I've spent diagnosing bugs in non-declarative languages that turned out to be due to the fact the variable != varaible. This can be alleviated by a decent IDE that will warn you, but in general I don't see this "feature" as a plus.
int itemcount = 0;
while itemcount
end while
welcome to an endless loop...
Re:Totally fresh in programming (Score:3, Interesting)
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 b
Re:Totally fresh in programming (Score:4, Insightful)
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.
Re:Totally fresh in programming (Score:3)
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 t
Re:Totally fresh in programming (Score:3, Insightful)
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.
Re:Totally fresh in programming (Score:4, Informative)
Re:Totally fresh in programming (Score:2, Interesting)
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 i
Re:Totally fresh in programming (Score:3, Insightful)
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 i [hobix.com]
Re:Totally fresh in programming (Score:2)
If they are new to programming that is an absolute non-issue. Don't talk about whitespaces at all, it's totally unnecessary, just tell them to follow the block indenting. AKA everything having the same left margin belongs to the same code block. Use how lots of books displays their table of contents, with chapters and subchapters differently indented as an example.
Re:Totally fresh in programming (Score:3, Informative)
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.
Re:Totally fresh in programming (Score:2)
First lesson: yes, you are. If you want to be a programmer, that's how you will start. You're the smartest, but you just don't know everything.
What platform are you using? It makes a difference.
I learned to progam (well, if you call it that) using BASIC on a TRS-80 Model II (with the 16K expansion, thank you very much!). The cassette tape storage would lose half my saves, so my devotion to backups was burned in.
Just pick a language you ca
Re:Totally fresh in programming (Score:2)
Err, my bad (Score:2)
Re:Totally fresh in programming (Score:2)
Absolutely. It's been used quite a bit for teaching purposes already, check out the Education special interest group [python.org] for more information.
You won't find many experienced programmers who started out with Python, simply
Re:Totally fresh in programming (Score:2)
For Blender, Python is our embeded scripting language. We have had a number of artists who came from knowing nothing about programming to writing some useful tools and scripts. It is very easy for non programmers t
Re:Totally fresh in programming (Score:2)
One thing to look out for though that caught me: class methods, when you define them, must have "self" as their first argument. You never use it when actually calling the method, it's just an invisible parameter that must be there first when you define it. There seems to be some technical reason for it, but I don't know what it is.
I bring this up because it c
Re:Totally fresh in programming (Score:3, Interesting)
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
I started with Perl (Score:2, Informative)
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
Devouring? (Score:5, Informative)
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.
Re:Devouring? (Score:4, Insightful)
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.
Re:Devouring? (Score:2)
Re:Devouring? (Score:2)
Then what would you use?
Re:Devouring? (Score:3, Interesting)
Here are the current Freshmeat [freshmeat.net] 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.
Re:Devouring? (Score:5, Interesting)
"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.
Re:Devouring? (Score:4, Interesting)
Re:Devouring? (Score:3, Interesting)
"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
Re:Devouring? (Score:5, Insightful)
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!
Re:Devouring? (Score:3, Insightful)
Re:Devouring? (Score:2)
about dynamic grouth.
Do the same query one more time in a month and then
compare numbers. Ones that change faster are the ones
that deserve "devouring" attribyte.
Pretty sure, Python will be one of them
I like and use Python, but this just doesn't make sense. You can change as fast as you like, but unless you have significant presence, you can't seriously be said to be 'devouring' anything!
Otherwise I could declare that COBOL is devouring everything because
On a related note... (Score:3, Informative)
It's licensed under the Creative Commons "Attribution-Share-alike" License, so feel free to pass it around if you want to.
Re:On a related note... (Score:2)
O, yeah? (Score:3, Insightful)
Perhaps it is time for you to get a perl book or take CS-101 course or something.
Re:O, yeah? (Score:5, Insightful)
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:
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.
Re:O, yeah? (Score:5, Insightful)
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;
Re:O, yeah? (Score:3, Interesting)
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, tho
Re:O, yeah? (Score:3, Insightful)
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
Re:O, yeah? (Score:3, Insightful)
Because the language designer probably doesn't know as much about your team and the problems you're trying to solve as you do.
Language Discipline (Score:3, Interesting)
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
Has to bash on Perl (Score:2, Insightful)
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.
Re:Has to bash on Perl (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.
Re:Has to bash on Perl (Score:2)
Not necessarily. It might mean that he's sick and tired of debugging the avalanche of horrid Perl that's already out there. (I know I am.)
Perl has been making complicated things simple for more than a decade.
Perl was definitely an improvement over what came before it. It doesn't follow, though that there aren't languages that are now definitely an improvement over it.
If you don't know how to write clean code, then your Python will also su
My 2 scents (Score:2, Offtopic)
My biggest gripe is that Python lacks a "use strict" to protect me from my own badd speling.
Re:My 2 scents (Score:2, Insightful)
Re:My 2 scents (Score:2)
Thanx!
the obligatory Python vs Perl post (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.
Re:the obligatory Python vs Perl post (Score:2)
LUKE: I feel cold.... death......
YODA: That file is strong with the dark side. A domain of perl it is. In you must go.
Simple, Legible Code (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.
Re:Simple, Legible Code (Score:3, Interesting)
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.
Python is a straightjacket (Score:4, Insightful)
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.
Dive into Python (Score:4, Informative)
python regexes (Score:2, Insightful)
Re:python regexes (Score:3, Informative)
you'd write something like
or if you're doing the same match many times:
(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 sho
Python is very tasty (Score:2)
It also goes well with a cup of Java, fried Kalamaris and a side of Perl pasta.
Python? Why not Ruby (on Rails)? Because ... (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)?
Why better stick with Python?
Chriss
--
memomo.net - brush up your German, French, Spanish or Italian - online and free [memomo.net]
python isn't just for web apps (Score:3, Insightful)
(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.)
Re:python isn't just for web apps (Score:3, Informative)
I have to wonder about this (Score:2)
hat 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.
I really have to wonder. Does someone have no idea what they are talking about or does a certain language have a very crappy garbage collector.
Anyone care to offer some insights as
Re:I have to wonder about this (Score:2)
Dive Into Python? (Score:2)
Learning Python (Score:3, Informative)
As a programmer experienced with OO programming and some other types of "scripting" languages, all I needed to read was Learning Python [oreilly.com] 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 [sf.net]
A few good and free Python books (Score:4, Informative)
I suggest:
Good reading.
most helpful book (Score:2, Insightful)
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.
-1 Troll for Submitter (Score:3, Insightful)
So can Perl.
Re:-1 Troll for Submitter (Score:2)
The issue of code readibility is why Perl is no longer my scripting language of choice.
Python is for architects - Perl is for lumberjacks (Score:2, Insightful)
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 woul
Python looks like a mess to me (Score:2)
Re:Python looks like a mess to me (Score:2)
If you want static typing use Java.
Re:Python looks like a mess to me (Score:2)
I tried python (Score:2)
Right now Ruby is my new Perl.
Python Riddles (Score:3, Interesting)
As if python itself wasn't fun enough :)
Artical summary blows it again. (Score:4, Insightful)
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.
Re:Civilization IV is Python and XML (Score:3, Informative)
Re:Civilization IV is Python and XML (Score:5, Informative)
The AI can be reprogrammed in C++ using their API. See Question 6 [slashdot.org]. I'm not positive that it's been released yet though.
Re:Beginner, no programing experince! (Score:2)
Another good (and fun) choice is Why's Poignant Guide to Ruby [poignantguide.net]. No other learning to program book has cartoon foxes.
Re:Damn perl bashing (Score:5, Informative)
Re:Damn perl bashing (Score:4, Insightful)
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!
Re:Before too many people post please read this! (Score:3, Informative)
Re:Perl vs. Python (Score:3, Informative)