> ## 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 String Length Comparison

#### Sourcery refactoring id: `simplify-string-len-comparison`

#### Description:

Changes an indirect comparison of a string's length to `0` into a direct
comparison of the string to the empty string.

#### Before:

```python
if len(s) == 0:
    ...

if len(r) > 0:
    ...
```

#### After:

```python
if s == "":
    ...

if r != "":
    ...
```

#### Explanation:

This refactoring avoids an unnecessary calculation and keeps the logic in the
domain of string types. It tends to unlock further improvements to string
comparisons.
