module question

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Wed Dec 19 23:48:54 EST 2001


> ----- Original Message -----
> From: 张少驰
>
> I have a question about a module's attribute and method. How can
> I know which attribute and method a method has?  For example, the
> module os has attribute 'WNOHANG' and method os.wait().

Read the manual, for starters.  Have you?

Strictly speaking, functions in a module aren't methods, they are
functions.

> My next question is os module may use waitpid method, as like
> os.waitpid(ret,os.WNOHANG), How can I know the relevant value of
> os.WNOHANG . If I use os.waitpid(ret,0),I want to know what this
> 0 relevantly refers? (I really don't know what this 0 refers
> to? please tell me)

Read the Unix or Linux (or BSD etc.) manual page for the relevant
function.  That's where most of them come from anyway; the os module
docs are a bit sketchy because the assumption is that you have access
to those docs also.

In this event, the WNOHANG constant is a flag value; that is, it
contains a bitmask type value.  When using such values, the
equivalent to "no options" is 0.  This is a C thing actually.

> Any idea will be appreciated.

Hope this helps.






More information about the Python-list mailing list