> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcery.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Simplify Empty Collection Comparison

#### Sourcery refactoring id: `simplify-empty-collection-comparison`

#### Description:

Replace an empty collection comparison with a more idiomatic unary operator.

#### Before:

```python
if a == "":
    do_anything()

while l == []:
    handle(l)
```

#### After:

```python
if not a:
    do_anything()

while not l:
    handle(l)
```

#### Explanation:

This refactoring follows the
[PEP 8 Programming Recommendations](https://www.python.org/dev/peps/pep-0008/#programming-recommendations),
specifically the recommendation that

> For sequences, (strings, lists, tuples), use the fact that empty sequences are
> false

in the context of comparisons.
