En Sun, 29 Apr 2007 17:27:59 -0300, Maxim Veksler <[EMAIL PROTECTED]>  
escribió:

> On 4/29/07, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> 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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to