On Fri, 2005-09-02 at 16:46, Laguna wrote:
> Paul,
> 
> Thanks for the suggestion on calendar module. Here is my solution and
> it works:
> 
> def expiration(year, month):
>       weekday = calendar.weekday(year, month, 1)
>       table = [19, 18, 17, 16, 15, 21, 20]
>       return table[weekday]
> 
> Cheers,
> Laguna

This, of course, can be "optimized" into

def expiration(year, month):
    return [19,18,17,16,15,21,20][calendar.weekday(year,month,1)]

;)

-Carsten


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to