I have two data structures,
def __contains__(self, item):
self.queue = Queue.Queue()
self.set = set()
from abc import ABCMeta
__metaclass__ = ABCMeta
Interesting question. Let me begin by saying that the very fact that this piece of ugliness is the way abstract classes are created in python2...
from abc import ABCMeta class Custom_Structure: __metaclass__ = ABCMeta
... already indicates that the Python Dictators didn't think marking classes as explicitly abstract was all that important.
That said, making a class abstract is a useful way of adding metadata to the code. It's a way for the author of a class to communicate with future users of a module.
What's being said? Two things:
An abstract class is incomplete, and should not be instantiated. An instance of this class has no concrete meaning, because the definition is partial. It lacks the full set of information necessary to make the object work.
An abstract method is the missing piece of the definition. By making a method abstract, you're stating that for the class to make sense, this specific part of the full description must be provided. Not only that, but by providing an interface you're conveying the expected behavior of the missing piece, whatever the internal details end up being.
Of course, all of this can be the case in practice without any additional specification for the class or its methods, but then inheritors end up guessing how to use the object, or have to read the documentation in detail.
If you instantiate an implicitly abstract class, sooner or later an error will occur. Could end up producing a
NotImplementedError, or a
KeyError when something's missing. This mistake is easy to make, and will arise down the road when trying to use the functionality of the object.
If you try to instantiate an explicitly abstract class, the error is immediate. No dice are thrown, and the problem is not postponed to whenever the class is used in one way or another. A missing implementation for abstract method won't cause an error when and if the method is used, but immediately when the coding mistake is made.
Summing up, making a class and some of its methods explicitly abstract makes the reality of the code adhere to the documentation. It moves the responsibility of knowing the rules from the inexperienced user to the author. It's a way of having the language runtime enforce in practice the theoretical rules and constraints of usage.