On 31.03.2016 23:08, Justin C. Walker wrote:
Hi, all,

I have couple of questions regarding "attributes" in Python/Sage:

1. If hasattr(X, "foo") returns True, does that mean that "X.foo" should not 
blow up?

this means X.foo is defined.
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

3. If "X.foo" is callable, is it expected that "X.foo()" will *not* blow up with 
"Not Implemented"?

No. For example you can have

class x(object):
        def foo(self): raise NotImplemented()

x = new X()
x.foo() # this will raise a not implemented exception. but x.foo is well defined.

bg,
Jo


I'm hoping that makes sense...

Thanks!

Justin

--
Justin C. Walker, Curmudgeon-At-Large, Director
Institute for the Enhancement of the Director's Income
--------
The path of least resistance:
it's not just for electricity any more.
--------




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