__call__ considered harmful or indispensable?

infidel saint.infidel at gmail.com
Fri Aug 3 00:55:01 CEST 2007


I find it useful in certain situations.  In particular, I have used it
along with cx_Oracle to provide a python module that dynamically
mirrors a package of stored procedures in the database.  Basically I
had class StoredProcedure(object) and each instance of this class
represented a particular stored procedure in the database.  It just
made sense to use the __call__ method to make these instances
callable.  Seemed silly to use some other method to actually call the
stored procedure in the database from such an instance.




More information about the Python-list mailing list