Deprecated slice method¶
ID: py/deprecated-slice-method Kind: problem Severity: warning Precision: very-high Tags: - maintainability Query suites: - python-security-and-quality.qls
Click to see the query in the CodeQL repository
__delslice__ methods have been deprecated since Python 2.0. In general, no class should implement these methods.
The only exceptions to this rule are classes that inherit from
list and override
list implements the slicing methods any class inheriting from
list must implement the the slicing methods to ensure correct behavior of
__delitem__. These exceptions to the rule will not be treated as violations.
Delete the slicing method. Any functionality should be moved to the equivalent
__getslice__should be replaced with
__setslice__should be replaced with
__delslice__should be replaced with
Python Language Reference: Additional methods for emulation of sequence types.