On Thu, Mar 31, 2016 at 2:08 PM, Justin C. Walker <jus...@mac.com> 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?

What's the definition of "blow up"?   I think X.foo could -- due to
Python "properties" -- run arbitrary Python code, e.g., to launch a
missile (or raise an exception).

>
> 2. Is there a way to tell, when hasattr(X, "foo") returns True, whether 
> "X.foo" can be called?
>
> 3. If "X.foo" is callable, is it expected that "X.foo()" will *not* blow up 
> with "Not Implemented"?

Not necessarily.

try:
    X.foo()
except (NotImplementedError, AttributeError):
   ....


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



-- 
William (http://wstein.org)

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