#6522: replace .copy() with .__copy__() in graphs/graph.py
------------------------------+---------------------------------------------
Reporter: AlexGhitza | Owner: was
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-4.3.1
Component: user interface | Keywords:
Work_issues: | Author: Karl-Dieter Crisman
Upstream: N/A | Reviewer:
Merged: |
------------------------------+---------------------------------------------
Comment(by rlm):
I can't say that I agree with the point of this ticket.
Certainly there should be a `__copy__` defined for graphs, so that
{{{
sage: G = copy(Graph())
}}}
works. However, the main use case of the `copy` method for graphs (for me,
at least) is when I want to change underlying implementations. What was
{{{
sage: G = graphs.PetersenGraph()
sage: C = G.copy(implementation='c_graph', sparse=False)
}}}
won't work as
{{{
sage: G = graphs.PetersenGraph()
sage: copy(G, implementation='c_graph', sparse=False)
}}}
but instead we now need to do:
{{{
sage: G = graphs.PetersenGraph()
sage: C = G.__copy__(implementation='c_graph', sparse=False)
}}}
Which is an ugly, pointless change in API. Why don't we just define
`__copy__`, and acknowledge that in some cases, it makes sense for objects
to have a `copy` method?
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/6522#comment:6>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.