#13394: Write a WeakValueDictionary with safer key removal
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner: rlm
Type: enhancement | Status: needs_review
Priority: major | Milestone: sage-5.13
Component: memleak | Resolution:
Keywords: | Merged in:
Authors: Simon King, Nils | Reviewers: Nils Bruin, Simon
Bruin | King
Report Upstream: None of the above | Work issues:
- read trac for reasoning. | Commit:
Branch: | 11bd210662b7dfa8eea2a6ff258980663ae14209
u/SimonKing/ticket/13394 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:93 SimonKing]:
> Nils, from the discussion at cython-users, it seems that the reason for
defining `dict.tp_print` is that for large dicts one would not like to
create a giant string and return it, but would like to print it bit by
bit.
I'm pretty sure that's why it was originally ''designed''. It seems that
subsequently `tp_print` wasn't found to be all that useful and hence
effectively removed. I haven't checked, but Stefan's comments suggest that
it's not used in Python3. I can see how that would happen: If one has a
huge data structure, one doesn't write it to a file in one go. One dumps
it more carefully.
> And this may give rise to a suggestion: Python could allow `__str__`
resp. `__repr__` to become iterators returning a list of strings, and then
it could print them bit by bit.
It's an elegant idea and probably how tp_print would be implemented if
iterators had been around earlier, but I'm pretty sure one wouldn't want
to slow down `__str__` etc. (internally they are C-speed for many types,
because they are slotted!) in general to gain a use-case that has been
shown to very rarely occur.
--
Ticket URL: <http://trac.sagemath.org/ticket/13394#comment:102>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.