News

Python Sets: remove() vs discard()

Python sets have two methods for removing elements: remove() and discard(). They look identical: colors = {“red”, “green”, “blue”} colors.remove(“green”)

Python try Without except

Mastering Python try Without except When you think of exception handling in Python, the try/except duo probably comes to mind.

What is a Python Decorator?

What is a Python Decorator? A Python decorator is a function that modifies another function or class without changing its

When to use getattr in Python

At some point in Python, you realize that writing object.attribute isn’t always enough. Sometimes: The attribute name comes from user