Posts for: #Puzzling Python

When Assert Does Not Raise

Asserts are a common way to quickly verify that inputs or other conditions are met. Python considers asserts as debug, leading to them sometimes being ignored.

[Read more]

How Do You Make a Tuple

Many methods exist within Python to create a tuple. Some are intuitive while others behave in strange ways. While type checking can help, complications abound.

[Read more]

Iterators as Function Inputs

Iterators as function inputs in Python can cause complex errors, due to storing references, differences between iterators and iterables, and other subtleties.

[Read more]

Iterable Membership Check

Using in for memberships in Python for iterables can behave differently. A list, dict, or iterator behave differently and type checkers may not find errors.

[Read more]