Thursday, December 1, 2011

Python: Modules

Introduction
You have seen how you can reuse code in your program by defining functions once. What if you wanted to reuse a number of functions in other programs that you write? As you might have guessed, the answer is modules. There are various methods of writing modules, but the simplest way is to create a file with a .py extension that contains functions and variables. Another method is to write the modules in the native language in which the Python interpreter itself was written. For example, you can write modules in the C programming language (http:/ / docs. python. org/ extending/ ) and when compiled, they can be used from your Python code when using the standard Python interpreter.
Read more. Lanjutkan!

No comments:

Post a Comment