Python Module: Difference between revisions

From GM-RKB
Jump to navigation Jump to search
(Created page with "A Python Module is a software module file that contains Python definitions and Pythong statements. * <B>Context:</B> ** It can be used by a Python Program....")
 
m (Text replacement - ". ----" to ". ----")
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
A [[Python Module]] is a [[software module file]] that contains [[Python definition]]s and [[Pythong statement]]s.
A [[Python Module]] is a [[software module]] that contains [[Python definition]]s and [[Python statement]]s.
* <B>Context:</B>
* <B>Context:</B>
** It can be used by a [[Python Program]].
** It can be used by a [[Python Program]] (by importing it with a [[Python Import Statement]])[https://docs.python.org/3/reference/import.html].
* <B>See:</B> [[Perl Package]].
** It can have a [[Python Module Name]] ([[file name]] is the [[Python Modeul Name|module name]] with the [[suffix .py]] appended. Within a [[Python Module|module]], the [[Python Module Name|module’s name]] (as a [[Python String|string]]) is available as the [[software variable value|value]] of the [[Global Python Variable|global variable]] <code>__name__</code>.).
* <B>Example(s):</B>
** [[pandas Module]], [[scipy Module]], [[numpy Module]], [[sklearn.svc Module]], ...;
** [[ReadMWDump Module]];
** [[WikiPageNoiseAdder Module]].
** …
* <B>Counter-Example(s):</B>
** a [[Perl Package]].
* <B>See:</B> [[Python Code]], [[Python Variable]].
 
----
----
----
----
==References==


===2013===
== References ==
 
=== 2015 ===
* http://docs.python.org/3/library/statistics.html
** QUOTE: This [[Python Module|module]] provides [[functions for calculating mathematical statistics of numeric (Real-valued) data]].
 
=== 2013 ===
* https://docs.python.org/2/tutorial/modules.html
* https://docs.python.org/2/tutorial/modules.html
** If you quit from the Python interpreter and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer program, you are better off using a text editor to prepare the input for the interpreter and running it with that file as input instead. This is known as creating a script. As your program gets longer, you may want to split it into several files for easier maintenance. You may also want to use a handy function that you’ve written in several programs without copying its definition into each program. <P> To support this, [[Python]] has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Such a file is called a module; definitions from a module can be imported into other modules or into the main module (the collection of variables that you have access to in a script executed at the top level and in calculator mode).   <P>   A [[Python Module|module]] is a file containing [[Python definitio]]ns and [[Python statement|statement]]s. The [[file name]] is the [[module name]] with the suffix .py appended. Within a module, the module’s name (as a string) is available as the value of the global variable __name__. For instance, use your favorite text editor to create a file called fibo.py in the current directory with the following contents: ..
** If you quit from the [[Python interpreter]] and enter it again, the definitions you have made (functions and variables) are lost. Therefore, if you want to write a somewhat longer [[Python Program|program]], you are better off using a [[text editor]] to prepare the input for the [[Python interprete|interpreter]] and running it with that file as input instead. This is known as creating a [[Python script|script]]. As your program gets longer, you may want to split it into several [[Python Code File|file]]s for easier maintenance. You may also want to use a handy function that you’ve written in several programs without copying its definition into each program.       <P>         To support this, [[Python]] has a way to put definitions in a file and use them in a [[Python Script|script]] or in an [[interactive instance]] of the [[Python interpreter|interpreter]]. Such a file is called a [[Python Module|module]]; definitions from a [[Python Module|module]] can be imported into other [[Python Module|module]]s or into the [[main module]] (the collection of variables that you have access to in a [[Python Script|script]] executed at the top level and in calculator mode).       <P>           A [[Python Module|module]] is a file containing [[Python definitio]]ns and [[Python statement|statement]]s. The [[file name]] is the [[Python Modeul Name|module name]] with the [[suffix .py]] appended. Within a [[Python Module|module]], the [[Python Module Name|module’s name]] (as a [[Python String|string]]) is available as the [[software variable value|value]] of the [[Global Python Variable|global variable]] <code>__name__</code>. For instance, use your favorite text editor to create a file called fibo.py in the current directory with the following contents: ..


----
----
__NOTOC__
__NOTOC__
[[Category:Concept]]

Latest revision as of 00:03, 23 September 2021

A Python Module is a software module that contains Python definitions and Python statements.



References

2015

2013