On Friday, April 1, 2016 at 4:19:08 PM UTC+2, Erik Bray wrote: > > One of my top wishlist items for Python 4 is some kind of __hasattr__ > special method for classes and/or an equivalent for descriptors that > merely guarantees* that accessing the attribute of that name will not > result in an AttributeError. That would be extremely useful for > checking attribute availability without computing / returning a value >
IMHO its generally bad to raise exceptions from @properties. Besides the obvious usability issue (why does tab completion raise a ZeroDivision error?), properties shouldn't have side effects. You are just querying the state of your object. And since you'd never allow an internally inconsistent object to be built, there just can't be an exception raised when you query its state. In other words, if it can potentially raise then it should be obj.method() instead of object.property. -- 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.