You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__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.);
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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 returnFalse
, or the result ofis self
(in this respect should we haveNoneContainer is NoneIterable
as is the case right now, etc.);__ne__
same discussion here.Beta Was this translation helpful? Give feedback.
All reactions