[Checkins] SVN: zope.app.keyreference/trunk/src/zope/app/keyreference/persistent.py point out what the optimization really is; it's not that Python's isinstance
Fred L. Drake, Jr.
fdrake at gmail.com
Fri Aug 15 02:22:49 EDT 2008
Log message for revision 89867:
point out what the optimization really is; it's not that Python's isinstance
is slow, but that object state may need to be unpickled as a side effect
Changed:
U zope.app.keyreference/trunk/src/zope/app/keyreference/persistent.py
-=-
Modified: zope.app.keyreference/trunk/src/zope/app/keyreference/persistent.py
===================================================================
--- zope.app.keyreference/trunk/src/zope/app/keyreference/persistent.py 2008-08-15 05:35:22 UTC (rev 89866)
+++ zope.app.keyreference/trunk/src/zope/app/keyreference/persistent.py 2008-08-15 06:22:48 UTC (rev 89867)
@@ -63,7 +63,9 @@
if self.key_type_id == other.key_type_id:
# While it makes subclassing this class inconvenient,
# comparing the object's type is faster than doing an
- # isinstance check.
+ # isinstance check. The intent of using type instead
+ # of isinstance is to avoid loading state just to
+ # determine if we're in conflict resolution.
if type(self.object) is PersistentReference:
# We are doing conflict resolution.
assert isinstance(other.object, PersistentReference), (
More information about the Checkins
mailing list