Try   HackMD

The snake of Theseus - Pablo Galindo Salgado

歡迎來到 PyCon TW 2023 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

共筆入口:https://hackmd.io/@pycontw/2023
手機版請點選上方 按鈕展開議程列表。
Welcome to PyCon TW 2023 Collaborative Writing
Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Collaborative Writing Workplace:https://hackmd.io/@pycontw/2023
Using mobile please tap to unfold the agenda.

Collaborative writing start from below
從這裡開始共筆
Slido

This talk is about what makes python feel like python.

01 - the ship of theseus

philosophy dilemma: If you replace all part of this ship, it is still the same ship?

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Source: https://github.com/erikbern/git-of-theseus

as we changed python as we remove or add up things
(code survive over time)

we don't changed things (it's the same ship)

python is really written by a lot of people, the things become more complicated.

Python is changed quite quickly.

Python is actually does not exist.
(radio waves metaphor. You can not see the pink color on the spectrum. It's combanation of different photons)

different people have different ideas

Python only exists in our mind

lives in minds

02 - The Grammar

who says what is python and what is not - it's grammar
(rule_names example)

metagrammar: grammars describe grammars

describe what is python
(expanded rules)

LL1-grammar
simple and restrict
idomtic simple to write, coded in LL1
reference:Full Grammar specification

  1. Left to right
    parses input from left to right

  2. Leftmost derivation

  3. 1 Token Lookahead
    Biggest restriciton

Grammar restriction

(break example)

is something continue could be a simple statement?

(ambiguous rules)

ars est quelare artem

it's importment that when you creating things do not get in the middle
(if you write after a grammar, it's ambiguous/complicated)

  • nonterminal in the grammar
  • to make it run in liner
    memoization..
  • context in grammars

1st python 1990

PEG parsers have infinite backtracking

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

03 A New Garmmar World

in python sometimes we are introducing new keywords(ideas)

hard keywords: can not be used as varibles

soft keywords: contextual, some words can be used as variables(e.g. await, async in py3.4, 3.5), backward compatible
(e.g the use of underscore)

pep636 structure

only possible with the new peg parser

Python 3.10 release note:

04 The Storm of Tpying

the two main topics

  • static typing
    • is used by tools analysing the source code without excuting it (e.g. mypy)
  • Dynamic typing
    • is examine at runtime to produce some effects (e.g. Pydantic)

Did you know this?

  • PEP 484
    • Introduced the typing lang with syntax, annotations, the typing module and other infrastructure.
  • PEP 563
    • Introduced from __future__ import annotations
  • PEP 649
    • Expands the effect of from __future__ import annotations

how users see annotations

  • small projects and education

  • enterprise and large projects

PEP 649 is accepted for Python 3.12

05 battling the GIL

  • OCT.7 2021
    • NOGIL Python targeting 3.11
  • JAN 9 2023
    • PEP 703 - tentatively accepted for Python 3.13
  • July 28 2024

Challenges of nogic

  1. maintanance: increase the Python team's maintenance bourden

  2. compatibility: isses for C extensions

  3. performance
    NOGIL

  4. packaging: for a while packages might need to be released in two versions (as GIL and NOGIL), which complicates releases and testing too

20

Types of programs

I/O bounded code: doesn't quite benefit from NOGIL
CPU bounded code: does benefit from NOGIL if there's parallelism
Mixed workload

Timeline of adoption

01 0-3 years : experimental builds
02 3-5 years : suppported builds
03 5+ years : NOGIL is the only build of Python

Challengs for c extensions

global state

debugging is harder

implicit gil as lock

interoperabitpality

looking infrastructure

validation

The Snake of Theseus

pablogsal@gmail.com

@pyblogsal

  1. what is the biggest difference

it has to be something

  1. as a thought experiment

  2. can you share us one mistake you've made as a CPython
    change from [] to main

. would you consider

. how would you suggest for

  1. how to consolidate everyone's understanding of python

fantastic question, it's hard

. what's the hardest

Below is the part that speaker updated the talk/tutorial after speech
講者於演講後有更新或勘誤投影片的部份