-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Thomas Lotze wrote:
> Jim Fulton <[EMAIL PROTECTED]> wrote:
> 
>> I would change it to just use getattr rather than hasattr.
>>
>> try:
>>     getattr(ob, name)
>> except AttributeError:
>>     return False
>> ...
> 
> This doesn't handle the case that the attribute exists as a property
> but raises an AttributeError when trying to produce its value.

What is the difference?  Any property which raises an attribute error is
broken, and does not satisfy the contract of the interface:  it might as
well not be there at all.

On a de gustibus note, I would have spelled it without the try:

 return getattr(ob, name, ob) is not ob



Tres.
- --
===================================================================
Tres Seaver          +1 540-429-0999          [EMAIL PROTECTED]
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFI9hhp+gerLs4ltQ4RAvYYAJkBpvcecqFmmSf9c9KMtPITnocOgQCghD71
irczDNf47QMt2qXB6LuBPKw=
=Atrg
-----END PGP SIGNATURE-----

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to