"Bob Roberts" <bo*******@byu.edu> wrote in message
news:c4**************************@posting.google.c om...
I'm sure there must be a better way to do this:
try:
if item.page:
DoSomething()
except AttributError:
pass
This checks both the item.page exists and that it has a True value.
Is that exactly the check you want? Catching attribute errors with
try..except a standard Python idiom.
Is there a simple way to check if item has "page" as one of its
attributes?
enter 'help(hasattr)' at prompt or check lib ref 'builtin functions'.
If item is often missing a page, (>10% of tries), then explicit test
might be better.
Terry J. Reedy