Python First Impression
I’ve been using Python now for just about two weeks; I’m falling in love.
Let’s see, where do I begin. Python makes lots of things really, really easy — things like date formating, date comparisons, db interaction, list manipulation, etc. The list goes on. Its built-in support for dictionaries and tuples make it super easy to never, ever define a Java Bean-style class, yet they’re in many ways more powerful than C-style structs.
Python module (egg) support is unreal. A module exists for just about any task you’d ever want to fulfil — modules for XHTML parsing, modules for URL fetching, etc.
In summary, Python has the speed and flexibility of Perl, with much more powerful built-in support.
Complaints: all member functions need to have the “self” parameter as the first parameter. In order to have a Python file execute something, one must add a line, “if __name__ ==’__main__’:.” This is just weird.
Mmmmm. Python.
Update: I forgot about my biggest complaint of all: how Python deals with default parameters. Read more here, or take a look at the quote below:
Default parameter values are evaluated when the function definition is executed. This means that the expression is evaluated once, when the function is defined, and that that same “pre-computed” value is used for each call.
8 Comments so far
Leave a reply

so where are you putting this python to work? details!
Haha, I’ll share later!
Man, ditto. My complaint is that some string manipulating functions (like .extend()) change the original string instead of creating a new one.
Also, do you actually need to do that? I thought that’s only if you want to to double as a module. I never use that.
If a file has a class, then that class needs to be invoked somehow. One way to do this would be to just put code outside of the class in the same file, but then that code would be invoked if that class is imported elsewhere.
I don’t understand your biggest complaint. Would you rather it evaluate it every time? The only time I can see it mattering is when your default expression mutates something. Is this what you want?
Jordan, I would rather see the default parameter always used, not the default parameter used the first time, then all remaining times the first non-default used. This just does not seem intuitive.
If I write code, “variable = 5,” then I would expect variable to have a value of 5 immediately after this assignment. However, if this assignment is in the context of a default variable, then sometimes it won’t be 5; sometimes it will be another value entirely. This is not intuitive.
I’ve heard many people complain about this feature. They have said they spent hours debugging their software only to find that this is the out-of-the-box way Python works.
I hope this clears things up!
How does it compare to Ruby?
I don’t think a comparison between Ruby and Python, coming from me at least, would be that useful. I make this claim because I never really learned Ruby that well. The two languages are similar — make things easy, good object-oriented support, scripting essence, etc — but still different.
Given my limited knowledge of Ruby, I like Python much more. I find it to be easier to program in and generally more intuitive.