Optimizations of "None" objects · LLyaudet/python-none-objects · Discussion #3
Look first here : https://docs.python.org/3/library/collections.abc.html
Share your ideas about optimizing the "None" objects.
Here are the ideas I had so far:
__contains__should be a simple method that directly returns False, it concerns NoneContainer, NoneCollection and NoneMapping;__iter__should be a simple method that directly returns self, it concerns NoneIterable, NoneCollection and NoneMapping;__next__should be a simple method that directly raises the StopIteration exception, it concerns NoneIterable, NoneCollection and NoneMapping;__len__should be a simple method that directly returns 0, it concerns NoneCollection and NoneMapping;__getitem__should be a simple method that directly raises the KeyError exception, it concerns NoneMapping;keysshould be a simple method that directly returns self, it concerns NoneMapping;itemsshould be a simple method that directly returns self, it concerns NoneMapping;valuesshould be a simple method that directly returns self, it concerns NoneMapping;getshould be a simple method that directly returns its default, it concerns NoneMapping.
Here are the things where the discussion is wide open:
__eq__I don't know yet, should it returnFalse, or the result ofis self(in this respect should we haveNoneContainer is NoneIterableas is the case right now, etc.);__ne__same discussion here.