#13394: Write a WeakValueDictionary with safer key removal
-------------------------------------+-------------------------------------
Reporter: nbruin | Owner: rlm
Type: enhancement | Status: positive_review
Priority: major | Milestone: sage-6.0
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: | 1a12ce6982bbe1f050e4ae627972023d5ddfa5ef
u/SimonKing/ticket/13394 | Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by 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.
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. Such as (for a dictionary):
{{{
def __repr__(self):
yield "{"
i = self.iteritems()
k,v = i.next()
yield "%s: %s"%(k,v)
for k, v in i:
yield ", %s: %s"%(k,v)
yield "}"
}}}
If you think that this would be a reasonable feature, you could suggest it
to upstream (I guess you know the Python community better than I).
--
Ticket URL: <http://trac.sagemath.org/ticket/13394#comment:93>
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.