For an empty list, I'd recommend using []
. This will be faster, since it avoids the name look-up for the built-in name list
. The built-in name could also be overwritten by a global or local name; this would only affect list()
, not []
.
The list()
built-in is useful to convert some other iterable to a list, though:
a = (1, 2, 3)
b = list(a)
For completeness, the timings for the two options for empty lists on my machine (Python 2.7.3rc2, Intel Core 2 Duo):
In [1]: %timeit []
10000000 loops, best of 3: 35 ns per loop
In [2]: %timeit list()
10000000 loops, best of 3: 145 ns per loop