This product is not supported for your selected Datadog site. ().

Metadata

ID: python-best-practices/slots-no-single-string

Language: Python

Severity: Error

Category: Error Prone

Description

The __slots__ attribute must be a non-string iterable.

Learn More

Non-Compliant Code Examples

class MyClass:     __slots__ = "attr"  # should be an iterable      def __init__(self):         pass 

Compliant Code Examples

from django.apps import AppConfig   class TweetsConfig(AppConfig):     default_auto_field = 'django.db.models.BigAutoField'     name = 'tweets' 
class MyClass:     __slots__ = ("attr", )      def __init__(self):         pass 
https://static.datadoghq.com/static/images/logos/github_avatar.svg https://static.datadoghq.com/static/images/logos/vscode_avatar.svg jetbrains

Seamless integrations. Try Datadog Code Security