DEV Community

Discussion on: 15 Python tips and tricks every beginner should know !

Collapse
 
sanzoghenzo profile image
Andrea Ghensi

Just a quick note (that can count as another trick): you can simplify the my_filter function to the return x==3 or x%2==0

Collapse
 
aidri profile image
AIDRI

It's true that you can use that, but I wanted to keep it pretty clear in my post. But your trick is useful in "small" functions like this one to avoid making the code ugly

Some comments have been hidden by the post's author - find out more