On Mar 31, 2016, at 16:15 , David Roe wrote:

> On Thu, Mar 31, 2016 at 7:11 PM, Justin C. Walker <jus...@mac.com> wrote:
> 
>> 
>> 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.
>> 
> 
> Just because a method is callable doesn't mean that it can't raise
> exceptions, including NotImplementedErrors.  There's no reasonable way to
> tell if a method will raise an exception or not without calling it.

Shazbat!  I was afraid of that.

Thanks for the clarification.  Back to the keyboard...

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
-----------


-- 
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.

Reply via email to