python needs leaning stuff from other language
ben+python at benfinney.id.au
Fri Apr 3 04:52:20 CEST 2009
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> The usual answer to that is that there's already two ways of clearing a
> del alist[:]
> alist[:] = 
> and we don't need a third way. Dicts and sets need a clear() method,
> because there's no equivalent to slicing.
> I still think that alist.clear() would be a fine addition that
> matches my intuition and aesthetic sense. Alas, I'm apparently not
I think it would also be better to have One (and prefereably Only One)
Obvious Way To Do It. That obvious way, for those who work with
Python's ‘set’ and ‘dict’, is a ‘clear’ method. It seems best to have
‘list’ conform with this also.
> BTW Zac, on this list we don't appreciate top-posting, and we
> encourage people to trim the quoted replies.
\ “Generally speaking, the errors in religion are dangerous; |
`\ those in philosophy only ridiculous.” —David Hume, _A Treatise |
_o__) of Human Nature_, 1739 |
More information about the Python-list