weird code in Python interface - Mailing list pgsql-interfaces

From James Aspnes
Subject weird code in Python interface
Date
Msg-id Pine.LNX.4.20.9912011239590.7701-100000@pine.cs.yale.edu
Whole thread Raw
List 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@cs.yale.edu>



pgsql-interfaces by date:

Previous
From: Tom Lane
Date:
Subject: Re: [INTERFACES] Data Migration
Next
From: "Alexey V. Meledin"
Date:
Subject: Perfomance