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;
  • keys should be a simple method that directly returns self, it concerns NoneMapping;
  • items should be a simple method that directly returns self, it concerns NoneMapping;
  • values should be a simple method that directly returns self, it concerns NoneMapping;
  • get should 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 return False, or the result of is self (in this respect should we have NoneContainer is NoneIterable as is the case right now, etc.);
  • __ne__ same discussion here.