On Mar 31, 2016, at 15:37 , Vincent Delecroix wrote: > On 31/03/16 18:22, Johannes wrote: >> On 31.03.2016 23:08, Justin C. Walker wrote: >>> 2. Is there a way to tell, when hasattr(X, "foo") returns True, >>> whether "X.foo" can be called? >> >> X.foo and x.foo.__call__ is None > > !? > > The only way to go here is > > if callable(X.foo): > print "X.foo is callable"
Thanks for the all the responses. They help, but I'm sensing confusion (at least on my part): sage: Q Univariate Quotient Polynomial Ring in xbar over Rational Field with modulus x^2 sage: hasattr(Q,"is_integral_domain") True sage: Q.is_integral_domain <built-in method is_integral_domain of PolynomialQuotientRing_generic_with_category object at 0x19c8dcec0> sage: callable(Q.is_integral_domain) True sage: Q.is_integral_domain() --------------------------------------------------------------------------- NotImplementedError Traceback (most recent call last) <ipython-input-48-73145f43c3d0> in <module>() ----> 1 Q.is_integral_domain() NotImplementedError: Help and corrections much appreciated, as always. Thanks! -- Justin C. Walker Director Institute for the Enhancement of the Director's Income -- Fame is fleeting, but obscurity just drags on and on. F&E -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.