Is it possible to know how to use an undocumented .pyd file?
Dale Nagata
dnagata at istar.net
Sat Aug 19 14:12:11 EDT 2000
Luke Chen wrote:
>
> Hi.
>
> Is it possible to know how to use an undocumented .pyd file?
>
> Thanks in advance!
Try importing it and then calling dir()
Then find out what kind each object is.
Probably the most interesting are 'constants' and functions.
Knowing that an object is a function, query the function
object to determine its call parameters etc.
If you're really lucky, there might even be doc strings!
e.g.
>>> import socket
>>> dir(socket)
['AF_INET', ..., 'socket']
>>> type(socket.socket)
<type 'function'>
>>> dir(socket.socket)
['__doc__', '__name__', 'func_code', 'func_defaults', 'func_doc',
'func_globals', 'func_name']
>>> dir(socket.socket.func_code)
['co_argcount', 'co_code', 'co_consts', 'co_filename', 'co_firstlineno',
'co_flags', 'co_lnotab', 'co_name', 'co_names', 'co_nlocals
', 'co_stacksize', 'co_varnames']
>>> socket.socket.func_code.co_argcount
3
--
Dale Nagata | tel : +1 604.451.2700 ext. 2254 (UTC-0800)
Software Developer | fax : +1 604.437.9891
Creo Products Inc. | pgr : +1 604.691.8279
Burnaby BC Canada | http://www.creo.com/
More information about the Python-list
mailing list