__init__.py helps to locate the python moudle location.
It's important when you are doing an import a module to another module.
Thursday, March 22, 2012
Speed of compiled python file.....
As an important speed-up of the start-up time for short programs that use a lot of standard modules, if a file called "spam.pyc" exists in the directory where "spam.py" is found, this is assumed to contain an already-``byte-compiled'' version of the module spam. The modification time of the version of "spam.py" used to create "spam.pyc" is recorded in "spam.pyc", and the file is ignored if these don't match.
Normally, you don't need to do anything to create the "spam.pyc" file. Whenever "spam.py" is successfully compiled, an attempt is made to write the compiled version to "spam.pyc". It is not an error if this attempt fails; if for any reason the file is not written completely, the resulting "spam.pyc" file will be recognized as invalid and thus ignored later. The contents of the "spam.pyc" file is platform independent, so a Python module directory can be shared by machines of different architectures.
When the Python interpreter is invoked with the -O flag, optimized code is generated and stored in ".pyo" files. The optimizer currently doesn't help much; it only removes assert statements and SET_LINENO instructions. When -O is used, all bytecode is optimized; .pyc files are ignored and .py files are compiled to optimized bytecode.
A program doesn't run any faster when it is read from a ".pyc" or ".pyo" file than when it is read from a ".py" file; the only thing that's faster about ".pyc" or ".pyo" files is the speed with which they are loaded.
When a script is run by giving its name on the command line, the bytecode for the script is never written to a ".pyc" or ".pyo" file. Thus, the startup time of a script may be reduced by moving most of its code to a module and having a small bootstrap script that imports that module.
It is possible to have a file called "spam.pyc" (or "spam.pyo" when -O is used) without a module "spam.py" in the same module. This can be used to distribute a library of Python code in a form that is moderately hard to reverse engineer.
The module compileall can create ".pyc" files (or ".pyo" files when -O is used) for all modules in a directory.
Normally, you don't need to do anything to create the "spam.pyc" file. Whenever "spam.py" is successfully compiled, an attempt is made to write the compiled version to "spam.pyc". It is not an error if this attempt fails; if for any reason the file is not written completely, the resulting "spam.pyc" file will be recognized as invalid and thus ignored later. The contents of the "spam.pyc" file is platform independent, so a Python module directory can be shared by machines of different architectures.
When the Python interpreter is invoked with the -O flag, optimized code is generated and stored in ".pyo" files. The optimizer currently doesn't help much; it only removes assert statements and SET_LINENO instructions. When -O is used, all bytecode is optimized; .pyc files are ignored and .py files are compiled to optimized bytecode.
A program doesn't run any faster when it is read from a ".pyc" or ".pyo" file than when it is read from a ".py" file; the only thing that's faster about ".pyc" or ".pyo" files is the speed with which they are loaded.
When a script is run by giving its name on the command line, the bytecode for the script is never written to a ".pyc" or ".pyo" file. Thus, the startup time of a script may be reduced by moving most of its code to a module and having a small bootstrap script that imports that module.
It is possible to have a file called "spam.pyc" (or "spam.pyo" when -O is used) without a module "spam.py" in the same module. This can be used to distribute a library of Python code in a form that is moderately hard to reverse engineer.
The module compileall can create ".pyc" files (or ".pyo" files when -O is used) for all modules in a directory.
Features of python
Easy-to-learn
Easy-to-read
Easy-to-maintain
A broad standard library
Interactive Mode
Portable
Extendable
Databases
GUI Programming
Scalable
Easy-to-read
Easy-to-maintain
A broad standard library
Interactive Mode
Portable
Extendable
Databases
GUI Programming
Scalable
Python Programming
A programming language with strong similarities to PERL, but with powerful typing and object oriented features.
Commonly used for producing HTML content on websites. Great for text files.
Useful built-in types (lists, dictionaries).
Clean syntax, powerful extensions.
Natural Language ToolKit
Ease of use; interpreter
AI Processing: Symbolic
Python’s built-in datatypes for strings, lists, and more.
Java or C++ require the use of special classes for this.
AI Processing: Statistical
Python has strong numeric processing capabilities: matrix operations, etc.
Suitable for probability and machine learning code.
Commonly used for producing HTML content on websites. Great for text files.
Useful built-in types (lists, dictionaries).
Clean syntax, powerful extensions.
Natural Language ToolKit
Ease of use; interpreter
AI Processing: Symbolic
Python’s built-in datatypes for strings, lists, and more.
Java or C++ require the use of special classes for this.
AI Processing: Statistical
Python has strong numeric processing capabilities: matrix operations, etc.
Suitable for probability and machine learning code.
Subscribe to:
Posts (Atom)
Let's try to build scrum masters/project managers/software architects/even a company with training AI models
The concept: The basic concept is to build trained AI model for each role separately in scalable fashion within a private cloud. As an examp...
-
Quarkus gRPC Service Implementation from the scratch Requirement In order to produce most reliable, fast and maintainable products we can us...
-
The concept: The basic concept is to build trained AI model for each role separately in scalable fashion within a private cloud. As an examp...
-
Problem Statement: Suppose the Government plans to issue up to $10,000 of Savings Bonds. Four individuals applied for a total of $18,000 of...