| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Do we have a test that something like this continues to work correctly? If not, maybe we should add one: >>> class D(dict):
... pass
...
>>> d = D({None: None})
>>> assert d[None] is None
>>> D.__getitem__ = lambda self, item: 42
>>> assert d[None] == 42 |
Sorry, something went wrong.
|
This is probably worth an entry in "what's new" in case someone notices something change for some edge case. |
Sorry, something went wrong.
|
Also note merge conflict. |
Sorry, something went wrong.
Have a look at addition to whatsnew. Not sure if is right place so if you want something else then tell me what to put where or feel free to change as needed. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Will not wrap slot functions from base classes if they are not explicitly overridden on class creations.
Subclass __getitem__() performance even increases a bit from:
$ ./python -m timeit -s $'class d(dict): pass\ni = d({1:2})' "i[1]" 10000000 loops, best of 5: 28.5 nsec per loopto:
$ ./python -m timeit -s $'class d(dict): pass\ni = d({1:2})' "i[1]" 10000000 loops, best of 5: 21.6 nsec per loopRationale for the checks is as follows:
class C: __new__ = type.__dict__['__subclasscheck__']