socket module

Martin Sjögren martin at strakt.com
Mon Jul 9 10:48:59 EDT 2001


On Mon, Jul 09, 2001 at 09:43:39AM -0500, Skip Montanaro wrote:
[snip]
> Something vaguely like:
> 
>     PyObject *sockmodule, *sockfunc, *socket;
>     sockmodule = PyImport_Import("socket");
>     sockfunc = PyDict_GetItemString(PyModule_GetDict(sockmodule), "socket");
>     PyCall_Object(sockfunc, ...);

Yeah, this is roughly how I do things now. One problem I'm having though,
is that sure I can use the C equivalent of the 'hasattr' function to get
the methods of the socket objects, but I either have the overhead of doing
that every time I call a socket method, or the overhead of looking up all
those methods every time I need a new socket object (seeing as what I get
isn't a PyCFunction, but a PyCallable).

Oh well.

Martin

-- 
Martin Sjögren
  martin at strakt.com              ICQ : 41245059
  Phone: +46 (0)31 405242        Cell: +46 (0)739 169191
  GPG key: http://www.strakt.com/~martin/gpg.html




More information about the Python-list mailing list