Steven D'Aprano wrote: > Ron Adam wrote:
>> def count_records(record_obj, start=0, end=len(record_obj)): > > > That would work really well, except that it doesn't work at all. Yep, and I have to stop trying to post on too little sleep. Ok, how about... ? def count_records(record_obj, start=0, end='to-end'): if end == 'to-end': end = len(record_obj) n = 0 for rec in record_obj.data[start:end]: if not rec.isblank(): n += 1 return n This isn't really different from using None. While it's possible to avoid None, its probably not worth the trouble. I use it myself. Here's something interesting: import time x = None t = time.time() for i in range(1000000): if x==None: pass print 'None:',time.time()-t x = 'to-end' t = time.time() for i in range(1000000): if x=='to-end': pass print 'String:',time.time()-t >>> None: 0.46799993515 String: 0.360000133514 Of course the difference this would make on a single call in practically Nill. Anyway, time to call it a night so tomorrow I don't make anymore silly mistakes on comp.lang.python. :) Cheers, Ron -- http://mail.python.org/mailman/listinfo/python-list