Chalarangelo / 30-seconds-of-python

Short Python code snippets for all your development needs
https://www.30secondsofcode.org/python/p/1
Creative Commons Attribution 4.0 International
8.83k stars 1.26k forks source link

[BUG] syntax error in implementation of filter_non_unique #202

Closed geekypandey closed 4 years ago

geekypandey commented 4 years ago

A small syntax issue in the implementation of filter_non_unique.

from collections import Counter

def filter_non_unique(lst):
    return [item for item, count in counter = Counter(lst).items() if count == 1]

I think we could implement the similar thing in python3.8 using the Walrus operator ( :=).