#20499: Graphs: docstring of _add_ conflicts with function
-------------------------------------+-------------------------------------
Reporter: jmantysalo | Owner:
Type: defect | Status: needs_work
Priority: major | Milestone: sage-7.2
Component: graph theory | Resolution:
Keywords: | Merged in:
Authors: Jori Mäntysalo | Reviewers: David Coudert
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/jmantysalo/graphs__docstring_of__add__conflicts_with_function|
f05cd3f63f07dc35f913444d0e60cd3546321191
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Changes (by dcoudert):
* status: needs_review => needs_work
* reviewer: => David Coudert
Comment:
* "Labels of the resultin" -> "Labels of the resulting"
* a doctest is needed for the `TypeError` case of the `__add__` method.
* the error message could be improved, for instance to something similar
to
{{{
sage: 1+'a'
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
...
TypeError: unsupported operand parent(s) for '+': 'Integer Ring' and
'<type 'str'>'
}}}
We could using something like that, which is valid for both `Graph` and
`DiGraph`.
{{{
raise TypeError("adding a '{}' and a '{}' is not
defined".format(typeof(self),typeof(other))
}}}
* I'm not fully aware of python3 syntax, but I suggest to avoid using
`G._name = '%s disjoint_union %s'%(a, b)` and to prefer `G._name = '{}
disjoint_union {}'.format(a, b)`. Well actually this is certainly more
robust: `G.name('{} disjoint_union {}'.format(a, b))`.
--
Ticket URL: <http://trac.sagemath.org/ticket/20499#comment:13>
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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.