About 56 results
Open links in new tab
  1. python - What does "del" do exactly? - Stack Overflow

    Python is a garbage-collected language. If a value isn't "reachable" from your code anymore, it will eventually get deleted. The del statement, as you saw, removes the binding of your variable. …

  2. Difference between del, remove, and pop on lists in Python

    I thought del was a python 2 syntax holdover like print, but it still works in python 3.

  3. dictionary - When is del useful in Python? - Stack Overflow

    For instance, rather than deleting a variable, one could just assign None to it. And when deleting from a dictionary, a del method could be added. Is there a reason to keep del in Python, or is it a vestige of …

  4. python - What is the __del__ method and how do I call it ... - Stack ...

    May 3, 2021 · However, the documentation clearly states that: "Note: del x doesn’t directly call x.__del__ () — the former decrements the reference count for x by one, and the latter is only called when x’s …

  5. How does the `del` statement work in Python? - Stack Overflow

    Feb 19, 2013 · The del statement doesn't reclaim memory. It removes a reference, which decrements the reference count on the value. If the count is zero, the memory can be reclaimed. CPython will …

  6. python - Best way to remove elements from a list - Stack Overflow

    Feb 2, 2014 · Python’s lists are variable-length arrays, not Lisp-style linked lists. The implementation uses a contiguous array of references to other objects, and keeps a pointer to this array. This makes …

  7. python - Is the use of del bad? - Stack Overflow

    Apr 28, 2014 · The use of del is probably not bad, but the existence of the syntax del for deleting list indices is an awkward feature of the language, just like len(..), both of which annoy newcomers who …

  8. Python del and garbage collecting - Stack Overflow

    Aug 19, 2022 · Python del and garbage collecting Ask Question Asked 3 years, 7 months ago Modified 3 years, 7 months ago

  9. When am I supposed to use del in python? - Stack Overflow

    Sep 1, 2016 · The only situations where del is useful for me are: deleting items from lists, dicts or the like - or when you dont need large objects anymore but they are in a namespace that is going to exist for …

  10. python - Python3 で、`del`文が排除されなかったのはなぜですか?

    Mar 14, 2016 · 間違っているかもしれませんが関係あることないこと考えたのは1) Pythonは他の多くの言語と違って変数は変数そのものではなく、あるオブジェクトに束縛 (bind, bound)された名前に …