Re: I can't inherit from "compiled" classes ?
- From: "Gabriel Genellina" <gagsl-py2@xxxxxxxxxxxx>
- Date: Sun, 29 Apr 2007 20:38:22 -0300
En Sun, 29 Apr 2007 17:27:59 -0300, Maxim Veksler <hq4ever@xxxxxxxxx> escribió:
On 4/29/07, Marc 'BlackJack' Rintsch <bj_666@xxxxxxx> wrote:"""
from socket import socket
import select
class PollingSocket(socket):
pass
"""
`select.select()` is a function:
I understand what you are saying, and at the same time don't
understand why it doesn't work. Isn't "everything an object" in
python? And if something is an object does it not implies it's an
instance of some class?
I'm not sure if your last statement is true now, and certainly it was not true before Python 2.2; there were objects that were not class instances (numbers, functions, by example). Maybe some objects still remain that are not instances of any class.
Anyway, "an object" and "a class" are not the same thing, and you can't use an arbitrary object when you actually need a class.
Does this mean I can't somehow make this work: """class
PollingSocket(socket.socket, select):""" ?
Those things inside () are called "base classes"; this is "class" inheritance; you create a new "class" inheriting from existing ones. That is, you cant inherit from select, because select is a function, not a class.
--
Gabriel Genellina
.
- References:
- I can't inherit from "compiled" classes ?
- From: Maxim Veksler
- Re: I can't inherit from "compiled" classes ?
- From: Marc 'BlackJack' Rintsch
- Re: I can't inherit from "compiled" classes ?
- From: Maxim Veksler
- I can't inherit from "compiled" classes ?
- Prev by Date: Re: http pipelining
- Next by Date: Re: Launching an independent Python program in a cross-platform way (including mac)
- Previous by thread: Re: I can't inherit from "compiled" classes ?
- Next by thread: Re: I can't inherit from "compiled" classes ?
- Index(es):
Relevant Pages
|