Use cases for del
steve at REMOVEMEcyber.com.au
Thu Jul 7 10:24:58 CEST 2005
Ron Adam wrote:
> Why would you want to use None as an integer value?
> If a value isn't established yet, then do you need the name defined?
> Wouldn't it be better to wait until you need the name then give it a value?
Er, maybe I'm misunderstanding something here, but
surely the most obvious case is for default and special
def count_records(record_obj, start=0, end=None):
if end == None:
end = len(record_obj)
if start == None: # this is not the default!
# start at the current position
start = record_obj.current
n = 0
for rec in record_obj.data[start:end]:
if not rec.isblank():
n += 1
which you call with:
# current position to end
# start to end
# start to current position
More information about the Python-list