New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OrderedDict doesn't implement __sizeof__ #54074
Comments
Ordered dicts pretend to have the memory consumption as dicts: >>> import sys, collections
>>> sys.getsizeof({})
280
>>> sys.getsizeof(collections.OrderedDict())
280 |
I wonder if type metaclass can be taught to handle this in general for subclasses implemented in python. |
How do you want to "handle this in general"? |
Possibly by adding up __sizeof__'s of base and __dict__ in a generated function? With a special handling of slots ... May prove to be too complicated to be worth the effort. |
I agree that in the general case this would be better, but for |
I have a hard time caring about this. The main value of sys.getsizeof() |
The patch looks good. |
See r84852 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: