Surf Roots, Software Thoughts

A blog by Alex Loddengaard

Archive for the 'Python' Category

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

Python Datetime Format

I just spent about an hour Googling for the Python datetime format.  I thought I would share the link and give the guide some link juice.

3 comments