Closing socket file descriptors

js ebgssth at gmail.com
Sun May 20 06:26:03 EDT 2007


Hi Yang.

> Hi, thanks for your answer. Should I just use that object's close()
> method? Is it safe to assume that objects that have fileno() also have
> close()? (Statically typed interfaces would come in handy now.)
> I'm writing a simple asynchronous I/O framework (for learning purposes -
> I'm aware of the myriad such frameworks for Python), and I'm writing a
> wrapper around objects that can be passed into select.select(). Since
> select() requires objects that have fileno's, that's the only
> requirement I place on the wrapped object's interface, and thus why I've
> been using FD-based operations:

I'm not sure whether objects which have fileno always have close,
but I think it's always safe to use the object's close method.
How about keeping the wrapped object's interface consistent
in your framework?
It'd make your work moch easier.



More information about the Python-list mailing list