probably not, from the Python 2.5 manual

------------------
hasattr( object, name)

The arguments are an object and a string. The result is True if the
string is the name of one of the object's attributes, False if not.
(This is implemented by calling getattr(object, name) and seeing
whether it raises an exception or not.)
------------------

2009/8/13 Joshua Smith <jesm...@kaon.com>:
>
> I have a model which I have lots of instances of.
>
> I've recently added a property to this model.
>
> So now I'm holding an instance of this model, and I want to know if
> this is one of the new ones with the new property, or one of the
> legacy ones.
>
> If I just write:
>
> if inst.newProp:
>
> that will throw an exception.
>
> Is there a clean way to say "if this property exists in this instance"
> without resorting to try/except?
>
> -Joshua
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to google-appengine@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to