Title: Theory / Important / CS / Programming / Python / Manual{ / 1 - 2 Introduction
Tags: fromMath mathToDef FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning some_instruction mathToSee

Name: Physical lines
Definition: A sequence of characters terminated by an end-of-line sequence.
Chapter: 2
Section: 1.1

Name: Logical lines
Definition: A sequence of physical lines constructed by following the line joining rules, and ending with the token NEWLINE.
Chapter: 2
Section: 1.1

Question: Default encoding is
Answer: utf-8.
Chapter: 2
Section: 1.4

Name: Implicit line joining
Definition: A new line appearing in an expression in parentheses, square brackets or curly braces.
Chapter: 2
Section: 1.6

Name: Blank line
Definition: A logical line that contains only spaces, tabs, formfeeds and possibly a comment.
Chapter: 2
Section: 1.6

Question: Indentation level is determined by
Answer: the number of space beginning the line.
Chapter: 2
Section: 1.8

Question: A stack is constructed as follows
Answer: initialized at 0.
Chapter: 2
Section: 1.8
Context: python grammar
Answer2: If a line have more spaces than the preceding line, in which case this number is added to the stack and a INDENT token is generated
Answer3: If a line have a number \(n\) of space equal to or less than the preceding line, in which case every number of the stack greater than \(n\) is removed from the stack, and one DEDENT token is generated for each removed number of the stack.
Name: Indentation rule

Name: White space
Definition: Space, tab and formfeed.
Chapter: 2
Section: 1.9

Question: In case of ambiguity, a token is
Answer: as long as possible, when read from left to right.
Chapter: 2

Name: Identifier
Definition: A sequence of letter, _ and numbers and some unicode characters, not starting by a number.
Page: https://docs.python.org/3/reference/lexical_analysis.html#identifiers
Chapter: 2
Section: 3
Context: Python
Name2: Name

Name: Keyword
Definition: False, True, and, or, not
Chapter: 2
Section: 3.1
Context: Python
Definition2: None
Definition3: with
Intuition: Some reserved words of the language, which can not be used as ordinary identifiers.
Definition4: yeld
Definition5: assert
Definition6: async await
Definition7: pass
Definition8: for break continue while
Definition9: class
Definition10: def return lambda
Definition11: del
Definition12: if elif else
Definition13: try except finally raise
Definition14: import from as
Definition15: global nonlocal
Definition16: in is

Name: Tokens
Definition: NEWLINE
Chapter: 2
Context: python
Definition2: INDENT, DEDENT
Definition3: identifiers
Definition4: keywords
Definition5: litterals
Definition6: operators
Definition7: delimiters

Instruction: #
Effect: Start a new line and ignore everything after
Language: Python
Chapter: 2
Section: 1.3

Instruction: In the first two line, in comments:
coding[:=] enc
Effect: Set the encoding of the document to enc
Language: Python
Chapter: 2
Section: 1.4

Instruction: blank line
Effect: It is ignored
Language: Python
Chapter: 2
Section: 1.7

Instruction: tab
Effect: replaced by 1 to 8 spaces, in order for the total of space to be a multiple of 8
Language: Python
Chapter: 2
Section: 1.8

Instruction: TabError
Effect: Indentation with mixing of tab and spaces whose meaning is ambiguous
Language: Python
Chapter: 2
Section: 1.8

Name: magic method
Definition: A name that is defined by the interpreter and its implementation (including the standard library)
Page: 4, https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 1, 2
Section: 3.3
Context: Python
Name2: special method
Denoted by: method starting and ending with __
Name3: dunder methods

Name: CPython
Definition: The canonical implementation of the Python programming language, as distributed on python.org.
Context: Python
Extra: The term “CPython” is used when necessary to distinguish this implementation from others such as Jython or IronPython.

Name: Jython
Definition: Python implemented in Java.
Page: https://docs.python.org/3/reference/introduction.html

Question: Interest of Jython
Answer: scripting language for Java application
Page: https://docs.python.org/3/reference/introduction.html
Answer2: can be used to create applications using the Java class libraries

Name: IronPython
Definition: Python for .net, compiling directly to .NET
Page: https://docs.python.org/3/reference/introduction.html

Name: PyPy
Definition: Python implemented in Python
Page: https://docs.python.org/3/reference/introduction.html

Definition: Some lexical expression as described by foo
Page: https://docs.python.org/3/reference/introduction.html
Context: Python lexical definition
Notation: <foo>

Definition: Any single character between begin and end, included
Page: https://docs.python.org/3/reference/introduction.html
Context: Python lexical definition
Notation: begin...end

Definition: code satisfying either foo_1 or foo_2
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar rule
Notation: foo_1 | foo_2

Definition: any number of repetition of code satisfying foo
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar rule
Notation: (foo)*

Definition: some code satisfying foo1 followed by some code satisfying foo2
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar rule
Notation: foo1 foo2

Page: https://docs.python.org/3/reference/lexical_analysis.html
Syntactic sugar: backslash new line
Implementation: nothing (but it actually introduce a new line in the file)
Name: explicit line joining

Variable: INDENT
Meaning: Token representing a line which has more indentation than the previous one
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Variable: DEDENT
Meaning: Token representing a line which has not the implicit indentation but one less
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Question: How does Python grammar representing closing multiple indentation block simultaneously
Answer: Using as many DEDENT tokens as there is block getting closed
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Name: Inconsistent dedent
Definition: A dedent that does not go back to a previous indentation level
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Name: Unexpected indent
Definition: An INDENT that does not follow a block opening that would justify the indent
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Variable: NEWLINE
Meaning: The token separating two logical lines
Page: https://docs.python.org/3/reference/introduction.html
Context: Python grammar

Name: A soft keyword
Definition: An identifier that is a keyword only in some context
Page: https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 2
Section: 3.2
Context: Python
Intuition: compatibility with previous code, usable in some specific place. In 3.10 only used for pattern matching

Question: What are the standard use of _ (the symbel character identifier)
Answer: A wildcard in pattern matching
Page: https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 2
Section: 3.3
Context: Python
Answer2: internationalization with gettext
Answer3: unused variable

Name: Operators
Definition: + - * ** / // %
Page: https://docs.python.org/3/reference/lexical_analysis.html
Context: Python
Definition2: @
Definition3: << >>
Definition4: & | ^ ~
Definition5: :=
Definition6: < > <= >= == !=

Name: Delimiters
Definition: ( )
Page: https://docs.python.org/3/reference/lexical_analysis.html
Context: Python
Definition2: [ ]
Definition3: { }
Definition4: ,
Definition5: :
Definition6: .
Definition7: ;
Definition8: @
Definition9: =
Definition10: ->
Definition11: augmented assignment operators

Name: augmented assignment operator
Definition: += -= *= /= //=  %= @= &= |= ^= >>= <<= **=
Page: https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 2
Section: 6
Context: Python

Question: Characters which are always an error outside of string
Answer: $
Page: https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 2
Section: 6
Context: Python
Answer2: ?
Answer3: `

Question: Characters which have special meaning as part of other tokens or are otherwise significant to the lexical analyzer
Answer: ' "
Page: https://docs.python.org/3/reference/lexical_analysis.html
Chapter: 2
Section: 6
Context: Python
Answer2: #
Answer3: \