Dear Volker, dear Jason,

thank you for your answers!

So, I chose the wrong example "isinstance(x,int)". With other types to
test, PY_TYPE_CHECK will be faster.

@Volker
> But if you really write Cython code then you probably want to type the
> argument so that the compiler knows what x is.
>...
> Calling isinstance on a C variable x goes through IS_INSTANCE which builds
> an unnecessary python boolean.

Well, here I do *not* know at compile time what type to expect, so
that I can't type the argument (otherwise I won't need isinstance/
PY_TYPE_CHECK at all).

@Jason
> I see them imported in devel/sage/sage/ext/stdsage.pxi:

But is there a manual section or other reference? Searching for
PY_TYPE_CHECK on http://www.sagemath.org did not give a single hit.

Cheers,
Simon

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to