newbie questions

keirr keir.robinson at
Wed Mar 15 17:03:43 CET 2006

meeper34 wrote:
> Hi,
> I'm just starting out with Python, and so far I am thoroughly impressed
> with what you can do very easily with the language.  I'm coming from a
> C++ background here.  A couple of questions came up as I was thinking
> about dynamically typed languages:
> 1.  If someone releases an interface in Python, how does the user know
> what parameters the function takes/returns?
> 2.  If documentation is the answer to 1, then are there any Python
> documentation standards?
> 3.  Are there any tools out there that can extract the interface
> information from Python files and release it as documentation like
> header (.h) files?  I know there are tools like this for languages like
> C#.

epydoc: is used by a  bunch of people -
including me.
The documentation it produces is far from a header file, typically it
is in HTML
(although other output formats are available) but I find it does.

> 4.  Really basic question, and I'm sure I will learn this very quickly
> with more reading, but I'm confused by the lack of an entry point in a
> Python app, i.e. int main().

There is some idiom for this.

def main(*args, **kw):
    # do stuff
if __name__ == '__main__':
    # call main, perhaps with sys.argv

You put this at the bottom of the file you want to run.
The __name__ property will be '__main__' iff you have executed the file

from the command line.
In particular the code in the if __name__... block won't be run if you
just import the file.

All the best,


> Btw, I was turned on to Python from Bruce Eckel's article "Strong
> Typing vs Strong Testing."
> Thanks,
> John

More information about the Python-list mailing list