About 20,100,000 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 …

  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. How does the `del` statement work in Python? - Stack Overflow

    Sep 21, 2024 · 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 …

  4. 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 …

  5. 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 …

  6. 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 …

  7. 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 …

  8. How can I remove a key from a Python dictionary?

    88 del my_dict[key] is slightly faster than my_dict.pop(key) for removing a key from a dictionary when the key exists python

  9. How do I release memory used by a pandas dataframe?

    Aug 23, 2016 · 3135.109375 >>> del arr >>> usage() 2372.16796875 # numpy frees the array, but python keeps the heap big Reducing the Number of Dataframes Python keep our memory …

  10. python - Delete a column from a Pandas DataFrame - Stack …

    Nov 16, 2012 · Viewed from a general Python standpoint, del obj.column_name makes sense if the attribute column_name can be deleted. It needs to be a regular attribute - or a property …