Message65596
For the code below.. memory usage keeps increasing continuously.. This
does not happen in a 32-bit machine python build. i think it might be
the datetime module where the problem might be..
linux kernel version (both on 32-bit and 64 bit machine)
linux - 2.6.24.4-64.fc8
python version (both on 32-bit and 64 bit machine)
Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
now = datetime.datetime.now()
oneday = datetime.timedelta(days=1)
def birthdaycompare(a, b):
if a is None and b:
return 1
if a and b is None:
return -1
if a is None and b is None:
return 0
if a<b:
return -1
elif a==b:
return 0
else:
return 1
def compare_by(fieldname):
def comparedict(a,b):
return birthdaycompare(a[fieldname], b[fieldname])
return comparedict
def getbirthdays(friend_details):
new_f = []
birthday = None
birthday_dt = None
for f in friend_details:
if f.has_key('birthday'):
birthday = f['birthday']
if birthday and birthday !='':
birthday_split = birthday.split(',')[0]
if birthday_split == 'February 29':
birthday = 'February 28'
try:
birthday_dt =
datetime.datetime.strptime(birthday_split + ', ' + str(now.year) , '%B
%d, %Y')
if birthday_dt < (now - oneday):
birthday_dt =
datetime.datetime.strptime(birthday_split + ', ' + str(now.year+1) ,
'%B %d, %Y')
except:
birthday=None
birthday_dt=None
f['birthday'] = birthday
f['birthday_dt'] = birthday_dt
new_f.append(f)
new_f.sort(compare_by('birthday_dt')) |
|
Date |
User |
Action |
Args |
2008-04-17 22:26:09 | kevin3210 | set | spambayes_score: 0.0256112 -> 0.025611196 recipients:
+ kevin3210 |
2008-04-17 22:26:08 | kevin3210 | set | spambayes_score: 0.0256112 -> 0.0256112 messageid: <1208471168.76.0.0271810352377.issue2652@psf.upfronthosting.co.za> |
2008-04-17 22:26:08 | kevin3210 | link | issue2652 messages |
2008-04-17 22:26:07 | kevin3210 | create | |
|