Question about idioms for clearing a list

Fredrik Lundh fredrik at pythonware.com
Wed Feb 8 08:23:46 EST 2006


Ed Singleton wrote:

> Having bricks that work in lots of places makes the language
> 'guessable'.  "I've never cleared a list before, but I've cleared
> dictionaries and I guess the same way would work here".

f = open("foo")
f.clear()

sys.stdout.clear()

os.getcwd().clear()

shelve.clear()

s = "sky"
s.clear()

</F> 






More information about the Python-list mailing list