Unnecessary
del
statement in a local scope 421 if limit and limit < len(stack):
422 lines.append(Text.assemble((f'✂️ {len(stack)-limit} more…', 'dim')))
423 finally:
424 del stack 425 # Now print the lines
426 rich_console.print(*lines)
427
Unnecessary
del
statement in a local scope600 )
601
602 _title = declared_attr(__title)
603 del __title604
605 @property
606 def title(self: FrozenAttributionSubclassProtocol) -> str:
Unnecessary
del
statement in a local scope152 read={'member', 'editor'},
153 grants_via={None: {'admin': 'member'}},
154 )
155 del __member156
157 @declared_attr
158 @classmethod
Description
Passing a local variable to a del
statement results in that variable being removed from the local namespace.
When exiting a function all local variables are deleted, so it is unnecessary to explicitly delete variables in such cases.
It is recommended to remove this del
statement.
Not preferred:
def my_func():
task = do_some_task()
evaluate_task(task)
del task # This is unnecessary.
Preferred:
def my_func():
task = do_some_task()
evaluate_task(task)