Feature Structures in Python (Part II)

Greg Ewing (using news.cis.dfn.de) g2h5dqi002 at sneakemail.com
Thu Jun 19 22:59:06 EDT 2003


James Tauber wrote:
>     if type(object1) == type(object2) == dict:

A more modern way to write this is

    if isinstance(object1, dict) and isinstance(object2, dict):

which will also work if the objects happen to be
subclasses of dict.

-- 
Greg Ewing, Computer Science Dept,
University of Canterbury,	
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg





More information about the Python-list mailing list