This is `collections.Counter`. 

On Sat, Feb 5, 2022, 3:19 PM Mirmojtaba Gharibi <> wrote:
Hello there,

I have an idea for initializing a variable the first time it’s created; it can especially be helpful with containers, and dicts specifically. Let me demonstrate with some examples:

Dic = {} # format fruit:count
for fruit in fruits:
   If fruit in Dic:

With my proposal, using := to init (similar to how in math parlance, the := is used for defining something for the first time)

Dic =  {} # format fruit:count
For fruit in fruits:
   Dic[fruit]:= 0

Would be great to hear your feedback. Thanks.

Python-ideas mailing list --
To unsubscribe send an email to
Message archived at
Code of Conduct: