On Sat, Feb 5, 2022, 12:19 PM Mirmojtaba Gharibi <mojtaba.gharibi@gmail.com> wrote:

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
   Dic[fruit]+=1

To my eye, this does not look like a conditional assignment. And how would an operator like this work with objects other than dicts?

Besides, it's easier and clearer to write this as

dic = defaultdict(int)
for fruit in fruits:
    dic[fruit] += 1

--- Bruce