/var/cache/apt/archives not clean
Mary Gardiner
mary-sounder at puzzling.org
Tue Feb 15 18:50:02 CST 2005
On Wed, Feb 16, 2005, Rui Tiago Matos wrote:
> I feel like I should share my script for those interested. Please
> share your thoughts about it as I have almost no experience with
> python.
I'm not sure this is the right place for extended commentary, so I'll
keep it brief and maybe send something off-list later:
Standard Python style is not to have any code that will execute if
your file is ever imported. Currently if I import your script into
another Python file, the entire file will run at import time!
The way to avoid this is:
def main():
"""
This is the main function of your code, do all the scripty
things here
"""
# do some stuff
# this if statement checks that this module is being run directly
if __name__ == '__main__':
main()
-mary
More information about the ubuntu-devel
mailing list