Problem subclassing Database class

christhemule at my-deja.com christhemule at my-deja.com
Tue Aug 29 16:28:57 EDT 2000


In article <8oh003$ssa$1 at nnrp1.deja.com>,
  christhemule at my-deja.com wrote:
> I'm trying to subclass the DB class in the PyGreSQL module with the
> following code fragment:
>
> class Database(DB):
>     "Class providing a wrapper around the DB class in PyGreSQL"
>
>     def __init__(self, *args, **kw):
>         DB.__init__(self, args, kw)
>
>   ...snip....
>
> When trying to instatiate this class using:
> cnx = data.Database("pythontest")

Apologies, should have read the FAQ more carefully!!
This correction seems to work ...

    def __init__(self, *args, **kw):
        args = (self,) + args
        apply(DB.__init__, args, kw)






Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list