newbie questions
Luigi
luigipaioro at libero.it
Wed Mar 15 11:14:38 EST 2006
Hi!
1. Documentation... sorry...
2. There are no standars, it depends on the apidoc tool you want to use
3. I don't know, but when you extract the api documentation (using
tools as epydoc or happydoc) you have all the information you need (I
think)....
4. As your python code is a script code, you don't need a main()
function (like C): all the lines you write are directly executed. For
example a code:
---
#!/usr/bin/python
a=5
b=a+3
print b
---
is directly executed.
If you are writing a class:
---
#!/usr/bin/python
class Test:
_init__(self):
self.name="My test"
t = Test()
print t.name
----
This code instances a class Test and prints the name attribute.
Note that if you import a file containing the code above as a python
module, the last 2 lines are executed. In order to avoid it you must
write:
---
#!/usr/bin/python
class Test:
_init__(self):
self.name="My test"
if __name__ == "__main__":
t = Test()
print t.name
----
Like this you execute the last two lines only if you execute directly
your file with the python interpreter.
I hope this can help you.
Luigi
More information about the Python-list
mailing list