Skip to content

{ Monthly Archives } September 2007

Parsing dates

I often run into scenarios in which I need to parse date strings in datetime (or mxDateTime) objects. Of course I could write a general purpose robust module to do just that, but I would rather use (and acknowledge) the work of someone who is much smarter than myself and who has already done the [...]

Is a number prime?

I stumbled across a post today that demonstrated some straightforward python code for determining whether a number is prime:
def is_prime(n):
n = abs(n)
i = 2
while i < n:
if n % i == 0:
[...]