#18387: Use type(x) instead of x.__class__ in Cython
----------------------------------+------------------------
Reporter: jdemeyer | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.7
Component: performance | Resolution:
Keywords: | Merged in:
Authors: Jeroen Demeyer | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
----------------------------------+------------------------
Description changed by jdemeyer:
Old description:
> In cython code, replace
> {{{
> self.__class__
> }}}
> by
> {{{
> type(self)
> }}}
> For Cython extension types, we know that `type(x)` is `x.__class__`, so
> this code should be equivalent, but `type(x)` is a lot faster because
> Cython optimizes it.
New description:
In cython code, replace
{{{
cdef type t = x.__class__
}}}
by
{{{
cdef type t = type(x)
}}}
For Cython extension types, we know that `type(x)` is `x.__class__`, so
this code should be equivalent, but `type(x)` is a lot faster because
Cython optimizes it.
--
--
Ticket URL: <http://trac.sagemath.org/ticket/18387#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.