I can't inherit from "compiled" classes ?

half.italian at gmail.com half.italian at gmail.com
Sun Apr 29 22:00:12 CEST 2007


On Apr 29, 12:48 pm, "Maxim Veksler" <hq4e... at gmail.com> wrote:
> Hello list,
>
> I'm trying to subclass socket and select, for both I get:
> """ TypeError: Error when calling the metaclass bases
>     module.__init__() takes at most 2 arguments (3 given) """, I don't
> understand this error. Why would python try to pass 3 arguments (what
> are they) ?
>
> Googling for this error gave random results talking about try to
> inherit a "Package" but socket is definitely a class,
> (/usr/lib/python2.4/socket.py). Not sure about select thought.
>
> I've did the following to receive the error:
> """
> In [1]: import socket
>
> In [2]: class PollingSocket(socket):
>    ...:     pass
>    ...:
> ---------------------------------------------------------------------------
> exceptions.TypeError                                 Traceback (most
> recent call last)
>
> /home/hq4ever/<ipython console>
>
> TypeError: Error when calling the metaclass bases
>     module.__init__() takes at most 2 arguments (3 given)
> """
>
> What am I breaking wrong?
>
> Thank you,
> Maxim.
>
> --
> Cheers,
> Maxim Veksler
>
> "Free as in Freedom" - Do u GNU ?

Try:

import socket

class PollingSocket(socket.socket):
    pass

~Sean




More information about the Python-list mailing list