Title: Theory / Important / CS / Programming / Python / Manual{ / 2 literal
Tags: FromInstruction computer_to_instruction hasNotNewEffectReturnsMeaning some_instruction fromMath hasSeenConjDef mathToDef mathToSee type
On every note of this deck, unless a note says otherwise:
Chapter: 2

Instruction: Sequence of letters, with ', ", ''' or """ on both sides.
Language: Python
Section: 4.1
Typ: A string

Name: A formatted string litteral
Definition: A string, prefixed by \(f\), with some instruction to put values in it.
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Chapter: 2
Section: 4.3

Name: A binary digit
Definition: 0b followed by a sequence of 0 and 1
Chapter: 2
Section: 4.3

Name: An hexadecimal integer
Definition: 0x or 0X followed by a sequence of 0..9 and the 6 first letters abcdef and ABCDEF indifferently.
Chapter: 2
Section: 4.3

Name: An octadecimal integer
Definition: 0o or 0O followed by a sequence of 0..7.
Chapter: 2
Section: 4.3

Name: Floating point literals
Definition: The number, with a dot, and potentially ending by e or E + or - or nothing, and the exponent.
Chapter: 2
Section: 4.6

Instruction: nnnj
Effect: the imaginary literal of 0 + n i
Language: Python
Section: 4.7
Variables: nnn a number
Name: imagnumber

Instruction: _
Effect: result of last evaluation in interactive interpreted, otherwise undefined
Language: Python
Section: 3.2

Instruction: Top level identifier starting with a _
Effect: Not imported byN
from M import * from M
Language: Python
Context: In a module M
Section: 3.2

Instruction: __*__
Effect: System-defined names
Language: Python
Section: 3.2

Instruction: name starting with __*
Effect: are re-written to use a mangled form to help avoid name clashes between “private” attributes of base and derived classes
Language: Python
Context: In a class definition
Section: 3.2
Name: Class-private names.

Instruction: b prefix before a string
Effect: stating that the sequence is a sequence of bytes
Language: Python
Section: 4.1

Instruction: 'r' prefix before a string
Effect: stating that the sequence is raw, i.e. the \ are really backslash
Language: Python
Section: 4.1

Instruction: \N{name}
Effect: Character named name in the Unicode database
Language: Python
Section: 4.1
Where to use it: string

Instruction: \uxxxx in a string
Effect: Character with 16-bit hex value xxxx
Language: Python
Section: 4.1

Instruction: \Uxxxxxxxx in a string
Effect: Character with 32-bit hex value xxxxxxxx
Language: Python
Section: 4.1

Instruction: \ooo in a string
Effect: Character with octal value ooo
Language: Python
Section: 4.1

Instruction: \xhh in a string
Effect: Character with hex value hh
Language: Python
Section: 4.1

Instruction: Multiple adjacent string
Effect: The concatenation of those strings
Language: Python
Section: 4.2

Instruction: 'f' prefixing a string
Effect: A formatted string litteral
Language: Python
Section: 4.3

Typ: literal_char
Meaning: <any code point except "{", "}" or NULL>
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Language: Python
Context: formatted string litteral

Name: format_spec
Definition: NULL
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Context: formatted string litteral
Definition2: literal_char
Conjdef: A sequence of
Definition3: replacement_field

Name: conversion
Definition: Either "s", "r" or "a"
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Context: f-string
Intuition: The way to represents an expression in a f-stirng

Name: f_expression
Definition: A yeld expression
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Definition2: or a sequence of (conditional_expression | "*" or_expr) separated by an ,
Conjdef: Either

Name: replacement_field
Definition: f_expression
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Context: Formatted string literals
Definition2: ["!" conversion]
Conjdef: Enclosed in "{" "}", and in this order
Definition3: [":" format_spec]

Name: f_string
Definition: literal_char
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Chapter: 2
Section: 4.3
Definition2: "{ {" "} }"
Conjdef: A sequence of
Definition3: replacement_field

Instruction: {{
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: replaced by {
Language: Python
Context: Formatted string literals
Section: 4.3

Instruction: {foo}
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: replaced by the evaluation of foo, and then format()
Language: Python
Context: Formatted string literals
Section: 4.3

Instruction: {foo!r}
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: replaced by the evaluation of foo, on which repr is called, and then format()
Language: Python
Context: Formatted string literals
Section: 4.3

Instruction: {foo!a}
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: replaced by the evaluation of foo, on which ascii() is called, and then format()
Language: Python
Context: Formatted string literals
Section: 4.3

Instruction: {foo!s}
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: replaced by the evaluation of foo, on which str() is called, and then format()
Language: Python
Context: Formatted string literals
Section: 4.3

Instruction: {foo:bar}
Page: https://docs.python.org/3/reference/lexical_analysis.html#formatted-string-literals
Effect: Call format on foo with parameters bar, according to format minilanguage
Language: Python
Context: Formatted string literals
Section: 4.3

Name: A literal
Definition: stringliteral
Page: https://docs.python.org/3/reference/lexical_analysis.html,
https://docs.python.org/3/reference/expressions.html#literals
Chapter: 2, 6
Section: 4, 2.2
Context: Python
Definition2: bytesliteral
Conjdef: either
Definition3: integer
Intuition: A notation for a constant value or some built-in type
Definition4: floatnumber
Definition5: imagnumber

Instruction: 'foo' or "foo"
Page: https://docs.python.org/3/reference/lexical_analysis.html
Effect: represents literally the sequence of characters foo
Context: Python lexical definition

Page: https://docs.python.org/3/reference/lexical_analysis.html
Syntactic sugar: { expr = }
Implementation: expr = { expr }
Language: Python
Context: formated string