On Sat, 26 Sep 2015, Travis Scrimshaw wrote:
I would use:if n not in ZZ: raise ValueError(...)
Seems easy. But to make sure: does this work in all cases? I.e. raw Python ints, Sage Integers, maybe something else too? At least QQ(3) in NN seems to work.
How about positive integers? "n-1 in NN" gives bad error message if n is for example string. "n in NN and n>0"?
-- Jori Mäntysalo