On 2019-01-08, MRAB <pyt...@mrabarnett.plus.com> wrote: > On 2019-01-08 00:47, i...@koeln.ccc.de wrote: >> You might do something like >> >> if len(a) == 0 or all(i == a[0] for i in a[1:]): >> > You don't need to check the length of the list because if the list is > empty, 'all' will return True anyway.
Neat! I expected that a[0] would be executed in that case, but it is not. -- Neil Cerutti -- https://mail.python.org/mailman/listinfo/python-list