Browsing All Posts filed under »Python«

Accessing Configurations and Settings in Python

October 13, 2011

2

The Problem When coding in Python, we need a way to store configurations and settings in a file, then be able to access them in the code. Our requirements for accessing these settings are: Simple to learn and use — We would like to target novice coders Easy to understand Hierarchical of settings References ConfigParserShootout […]

Determine the Last Day of a Month

April 7, 2011

6

The Problem Given a year and a month, I want to determine the last day of that month. For example, if the year is 2004 and the month is 2, then the last day is 29th because of leap year. The Solution Calculating the last day of a month is not hard, but complicated by […]

Python List Assignment Caveat

January 11, 2011

5

The Problem In Python, the assignment operator (=) assign the reference to the list instead of making copy of it. The following interaction will demonstrate this concept: In line 1, we create a new list, original, with three elements. In line 2, we assign this list to a new variable, reference. In line 5, we […]

Follow

Get every new post delivered to your Inbox.

Join 36 other followers