Of Python, Pythonic, and Many Paths To Accomplish Something

I want to assure you, this is not a rant against Python. Three plus years ago, I would have been hard pressed to implement an entire store/forward system for our town’s water department using anything other than Python. I could have gotten away with not using Django, but it did not hurt to use Django for this project.

Today I asked a question in stackoverflow.com regarding how to take the following data:

{'cycle1': [1, 2407, 2393, 14],
 'cycle2': [2, 1657, 1652, 5],
 'cycle3': [3, 2698, 2673, 25],
 'cycle4': [4, 2116, 2102, 14],
 'cycle5': [5, 2065, 2048, 17],
 'cycle6': [6, 1633, 1615, 18]}
<code>


and sum each of the last three columns per row, so all column 1s are summed, all column 2s are summed and so on.

One of the comments to one of the questions indicated an object, rather than a list should be used. Doing so would be more Pythonic.

At a time, where there appears to be great interest in functional programming in languages like Haskell, Scala, and Clojure, why does Python appear to be moving towards objects? That is the great mystery to me.  I have nothing against objects, and worked a lot with the early Microsoft Visual Studio components as well as IBM’s OS/2 Presentation Manager toolkit. A lot of good object-oriented code has been written.

I am concerned about two things. Why do I hear there one way to do something in Python, and is there an apparent move toward objects? Is this just someone’s opinion or general to the Python community?

These are just my thoughts for the day, after migrating three-year old Python code to snap all our town’s reads, instead of just one section.

Advertisements

Leave a comment

Filed under python

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s