CESNET / NERD

Network Entity Reputation Database

Home Page:https://nerd.cesnet.cz/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug??] I can not find a matching `if`.

dianwoshishi opened this issue · comments

Is this a new feature of python? I can not find the matching if.
If it's a new feature of python, it may confuse others. I think using if&else will be more clear.

This is Python for/else construct. Maybe it's not so well known, but it isn't new (I think it already existed ~10 years ago when I started learning Python 2).

The code under else is executed when the for loop is not ended by break. A good explanation of how and why to use it is here, for example: https://stackoverflow.com/a/9980752

I really don't know before. I've learned it.
But It's a useful construct.