#19597: General code cleanup: avoid x.__eq__(y)
----------------------------------+-------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.10
Component: misc | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------------+-------------------------
Description changed by jdemeyer:
Old description:
> Replace code of the form
> {{{
> x.__eq__(y)
> x.__len__()
> x.__getitem__(y)
> x.__contains__(y)
> }}}
> by
> {{{
> x == y
> len(x)
> x[y]
> y in x
> }}}
> because the latter is more efficient.
>
> For `__repr__()`, we instead change `%s` to `%r` for `%`-formatting and
> `{}` to `{!r}` for `.format()`.
New description:
Replace code of the form
{{{
x.__eq__(y)
x.__len__()
x.__getitem__(y)
x.__contains__(y)
...
}}}
by
{{{
x == y
len(x)
x[y]
y in x
...
}}}
because the latter are more efficient.
For `__repr__()`, we instead change `%s` to `%r` for `%`-formatting and
`{}` to `{!r}` for `.format()`.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/19597#comment:2>
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/d/optout.