G
gry
Just curious about people's sense of style:
To delete all the elements of a list, should one do:
lst[:] = []
or
del(lst[:])
I seem to see the first form much more often in code, but
the second one seems more clearly *deleting* elements,
and less dangerously mistaken for the completely different:
lst = []
What do you think?
-- George Young
To delete all the elements of a list, should one do:
lst[:] = []
or
del(lst[:])
I seem to see the first form much more often in code, but
the second one seems more clearly *deleting* elements,
and less dangerously mistaken for the completely different:
lst = []
What do you think?
-- George Young