Skip to content

[New Rule]: rewrite dict.get(key, None) as dict.get(key) #171

@janosh

Description

@janosh

Explanation

dict.get(key) returns None by default if key is missing.

Example

# Bad
dict.get(key, None)

# Good
dict.get(key)

Related

Adding this rule should be coordinated with astral-sh/ruff#3546 for consistent naming.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions