If the my_list
variable is global, you can't do:
my_list = []
that just create a new reference in the local scope.
Also, I found disgusting using the global
keyword, so how can I empty a list using its methods?
If the my_list
variable is global, you can't do:
my_list = []
that just create a new reference in the local scope.
Also, I found disgusting using the global
keyword, so how can I empty a list using its methods?
How about the following to delete all list items:
def emptyit():
del l[:]