[Tutor] Deleted dictionary length not reporting
eryksun
eryksun at gmail.com
Wed Jul 17 12:01:53 CEST 2013
> On 16 July 2013 20:42, Steven D'Aprano <steve at pearwood.info> wrote:
>
>> Assuming that some_list is already a list, what's the difference between
>> these two lines, and under what circumstances why would you want to use the
>> second one?
>>
>> some_list = []
>> some_list[:] = []
3.3 adds clear() to list and bytearray (as per dict/set), so now there
are 3 simple ways to clear a list:
del some_list[:] # DELETE_SUBSCR
some_list[:] = [] # STORE_SUBSCR
some_list.clear() # CALL_FUNCTION
More information about the Tutor
mailing list