Python Essentials - Part 1 - History Flashcards

1
Q

Who is the creator of Python?

A

Guido van Rossum is the creator of the Python programming language.

He grew up in the Netherlands and studied at the University of Amsterdam, where he graduated with a Master’s Degree in Mathematics and Computer Science. His first job after college was as a programmer at CWI, where he worked on the ABC language, the Amoeba distributed operating system, and a variety of multimedia projects. During this time he created Python as side project. He then moved to the United States to take a job at a non-profit research lab in Virginia, married a Texan, worked for several other startups, and moved to California. In 2005 he joined Google, where he obtained the rank of Senior Staff Engineer, and in 2013 he started working for Dropbox as a Principal Engineer. In October 2019 he retired. Until 2018 he was Python’s BDFL (Benevolent Dictator For Life), and he is still deeply involved in the Python community. Guido, his wife and their teenager live in Silicon Valley, where they love hiking, biking and birding.

source:https://gvanrossum.github.io/bio.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is CPython?

A

CPython is a version of the Python Interpreter that is written in the C Programming Language. CPython is the original and usually default interpreter used to run Python programs, and is the interpreter currently developed by Python creator Guido Van Rossum.

Currently the CPython Interpreter supports versions 2.7 and 3.10

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Cython?

A

The Cython language is a superset of the Python language that additionally supports calling C functions and declaring C types on variables and class attributes.

This allows the compiler to generate very efficient C code from Cython code. The C code is generated once and then compiles with all major C/C++ compilers in CPython 2.6, 2.7 (2.4+ with Cython 0.20.x) as well as 3.3 and all later versions. We regularly run integration tests against all supported CPython versions and their latest in-development branches to make sure that the generated code stays widely compatible and well adapted to each version. PyPy support is work in progress (on both sides) and is considered mostly usable since Cython 0.17. The latest PyPy version is always recommended here.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Jython?

A

The Jython project provides implementations of Python in Java, providing to Python the benefits of running on the JVM and access to classes written in Java. The current release (a Jython 2.7.x) only supports Python 2 (sorry). There is work towards a Python 3 in the project’s GitHub repository.

Jython implementations are freely available for both commercial and non-commercial use. They are distributed with source code under the PSF License v2.

Jython is complementary to Java and is especially suited for the following tasks:

  • Embedded scripting - Java programmers can add the Jython libraries to their system to allow end users to write simple or complicated scripts that add functionality to the application.
  • Interactive experimentation - Jython provides an interactive interpreter that can be used to interact with Java packages or with running Java applications. This allows programmers to experiment and debug any Java system using Jython.
  • Rapid application development - Python programs are typically 2-10x shorter than the equivalent Java program. This translates directly to increased programmer productivity. The seamless interaction between Python and Java allows developers to freely mix the two languages both during development and in shipping products.

Source: https://www.jython.org

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is IronPython?

A

IronPython is an open-source implementation of the Python programming language which is tightly integrated with .NET. IronPython can use .NET and Python libraries, and other .NET languages can use Python code just as easily.

Source:https://ironpython.net

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is PyPy?

A

PyPy is a replacement for CPython. It is built using the RPython language that was co-developed with it.

The main reason to use it instead of CPython is speed: it runs generally faster (see next section).

PyPy implements Python 2.7.18, and 3.7.10. It supports all of the core language, passing the Python 2.7 test suite and almost all of the 3.7 test suite (with minor modifications) It supports most of the commonly used Python standard library modules. For known differences with CPython, see our compatibility page.

Source: https://www.pypy.org/features.html

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between a compiled and an interpreted program?

A

The difference between an interpreted and a compiled language lies in the result of the process of interpreting or compiling. An interpreter produces a result from a program, while a compiler produces a program written in assembly language. The assembler of architecture then turns the resulting program into binary code. Assembly language varies for each individual computer, depending upon its architecture. Consequently, compiled programs can only run on computers that have the same architecture as the computer on which they were compiled.

A compiled program is not human readable, but instead is in an architecture-specific machine language. Creating a compiled program requires several steps. First, the programmer, using a development tool or even a simple text editor, writes the source code in a chosen computer language. If the program is complex, pieces of it may be spread across several files. The programmer then compiles the program, sorting and linking the modules and translating it all into machine code that the computer understands.

Because different kinds of computers do not speak each others’ machine languages, a compiled program will only work on the platform it was designed for. For example, a program written for HP-UX normally will not work on a Mac OS computer or a computer running Solaris. Despite this drawback, compiled programs are faster than those that must be run through an interpreter. Also, it is often possible to recompile the program so that it will run on different platforms. Examples of languages that are normally used to produce compiled programs include C, Fortran, and COBOL.

An interpreted program, on the other hand, the source code typically is the program. Programs of this type (often known as scripts) require an interpreter, which parses the commands in the program and then executes them. Some interpreters, such as the Unix shells (sh, csh, ksh, etc.), read and then immediately execute each command, while others, such as Perl, analyze the entire script before sending the corresponding machine language instructions. The advantage of a script is that it is very portable. Any computer that has the appropriate interpreter installed may run the program more or less unchanged. This is a disadvantage as well, because the program will not run at all if the interpreter is not available. In general, interpreted programs are slower than compiled programs, but are easier to debug and revise. Other examples of interpreted languages include JavaScript and Python.

Examples of pure compiled languages are C, C++, Erlang, Haskell, Rust, and Go.

Source: https://kb.iu.edu/d/agsz

Video: https://www.youtube.com/watch?v=y6VvxGHCxa4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is Byte Code (according to python programming)?

A

Byte codes are referred to as the portable codes or p-codes. When a python code is interpreted into the machine language then the python code gets converted into bytes. These bytecodes are also called as the set of instructions for the virtual machine and the python interpreter is the implementation of the virtual machine. The set The intermediate format is called the bytecode. Bytecodes are :

  • Lower-level
  • Platform Independent
  • Efficient
  • Intermediate
  • Representation of source code

Bytecode is the low-level representation of the python code which is the platform-independent, but the code is not the binary code and so it cannot run directly on the targeted machine. It is a set of instructions for the virtual machine which is also called as the Python Virtual Machine[PVM]. When the Python code is interpreted it is converted to the compiled bytecode file referred to as the PYC file. Pyc files have the set of instructions to follow in sequence to generate the output. These pyc files are faster than the normal python code files.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Python 2.x vs Python 3.x ?

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When Python 2.7 End Of Life?

A

The End Of Life date (EOL, sunset date) for Python 2.7 has been moved five years into the future, to 2020.

There will be no 2.8 version …

Source: https://legacy.python.org/dev/peps/pep-0373/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is Python Package?

A

A package is nothing more than a folder, which must contain a special file,
__init__.py, that doesn’t need to hold any code but whose presence is required to tell
Python that the folder is not just some folder, but it’s actually a package

NB As of Python 3.3, the __init__.py module is not strictly required any more.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are four different scopes that Python makes accessible?

A

The order in which the namespaces are scanned when looking for a name is therefore: local,enclosing, global, built-in (LEGB).

  • The local scope, which is the innermost one and contains the local names.
  • The enclosing scope, that is, the scope of any enclosing function. It contains nonlocal names and also non-global names.
  • The global scope contains the global names.
  • The built-in scope contains the built-in names. Python comes with a set of functions that you can use in an off-the-shelf fashion, such as print, all, abs,and so on. They live in the built-in scope.

The rule is the following: when we refer to a name, Python starts looking for it in the
current namespace. If the name is not found, Python continues the search to the enclosing scope and this continues until the built-in scope is searched. If a name hasn’t been found after searching the built-in scope, then Python raises a NameError exception, which basically means that the name hasn’t been defined

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is PEP?

A

Python’s development is conducted largely through the Python Enhancement Proposal(PEP) process. The PEP process is the primary mechanism for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python.

NB: PEP 8 is perhaps the most famous of all PEPs. It lays out a simple but effective set of guidelines to define Python aesthetics so that we write beautiful Python code.

https://peps.python.org/pep-0008/

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is being Pythonic (Import This)?

A

The Zen of Python, by Tim Peters

Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren’t special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one– and preferably only one –obvious way to do it.
Although that way may not be obvious at first unless you’re Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it’s a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea – let’s do more of those!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly