[Tutor] [OT] Re: removing consecutive duplicates from list
Peter Otten
__peter__ at web.de
Wed Apr 21 08:04:36 EDT 2021
On 21/04/2021 11:56, dn via Tutor wrote:
> On 21/04/2021 19.39, Peter Otten wrote:
>> it = iter(items)
>> try:
>> prev = next(it)
>> except StopIteration: I hate you, Chris A. ;)
>> return
>> yield prev
> (not sure why we're beating-up Chris though)
https://www.python.org/dev/peps/pep-0479/
Prior to that you could write the above without the try...except.
More information about the Tutor
mailing list