0

Is 'del' a function or a statement?

25th Mar 2018, 2:19 AM
Lightly Salted7
4 Answers
+ 3
In Python 'del' is a built-in function. This operator stands for "delete." ... With del, we specify a list, dictionary or other collection. We pass an index or key we want to remove. ... Del examples. Here we call del to remove the third element in a list. ... Remove. This method is available on lists. ... Syntax. ... Dictionary, del. ... Performance. ... String error.
25th Mar 2018, 2:59 AM
BroFar
BroFar - avatar
+ 2
I think of it as more of a keyword. It is used as a prefix to DEFINE a function. However, in the guts of the source of Python (or Ruby if you're talking about) it may be a function to define a function.
25th Mar 2018, 2:34 AM
Dread
Dread - avatar
+ 2
Oh, I thought it said "def" not "del." 😂😂
25th Mar 2018, 3:00 AM
Dread
Dread - avatar
+ 2
ya me to at first which would have aligned with your answer @Jonathan
25th Mar 2018, 3:02 AM
BroFar
BroFar - avatar