weird code in Python interface

From: James Aspnes <aspnes(at)cs(dot)yale(dot)edu>
To: pgsql-interfaces(at)postgresql(dot)org
Subject: weird code in Python interface
Date: 1999-12-01 17:42:32
Message-ID: Pine.LNX.4.20.9912011239590.7701-100000@pine.cs.yale.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

Sorry to post this to the list but I'm not sure how to track down the
author. In pg.py and pgsqldb.py in the Python interface (version
6.5.3 RPMs) the following lines of code appear:

if not hasattr(self,e) and hasattr(self.db,e):
exec 'self.%s = self.db.%s' % ( e, e )

This would be safer, cleaner, and faster if rewritten as:

if not hasattr(self,e) and hasattr(self.db,e):
setattr(self, e, getattr(self.db, e))

--Jim Aspnes <aspnes(at)cs(dot)yale(dot)edu>

Browse pgsql-interfaces by date

  From Date Subject
Next Message Alexey V. Meledin 1999-12-01 17:51:44 Perfomance
Previous Message Tom Lane 1999-12-01 16:35:40 Re: [INTERFACES] Data Migration