0
this magic-method i dont understand it i prefer to give me example for etch one
__delitem__ __iter__ __contains__ if you give me example code i will be thankful for you
2 Answers
+ 2
They would be implemented for your class only if meaningful...
__delitem__ : called when you want custom delete on you object item in form
delete obj[item]
https://docs.python.org/3/reference/datamodel.html#object.__delitem__
__iter__: called when you want an iterator for iterate on you object https://docs.python.org/3/reference/datamodel.html#object.__iter__
__contains__: called when you want check if an item is contained in your object
https://docs.python.org/3/reference/datamodel.html#object.__contains__
I repeat, these have to be implemented ONLY if meaningful and you want custom handling for respective case
0
what is the function should call it in main programme to call the __delitem__ and __iter__