Slide 1

Slide 1 text

PEP 572 THE WALRUS OPERATOR ~ DUSTIN INGRAM PYCON US 2019 @di_codes

Slide 2

Slide 2 text

HI, I'M DUSTIN @di_codes

Slide 3

Slide 3 text

PEP 572 @di_codes

Slide 4

Slide 4 text

PYTHON GOVERNANCE @di_codes

Slide 5

Slide 5 text

BDFL BENEVOLENT DICTATOR FOR LIFE @di_codes

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

PEP PYTHON ENHANCEMENT PROPOSAL @di_codes

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

PEP 8 STYLE GUIDE FOR PYTHON CODE @di_codes

Slide 10

Slide 10 text

PEP 8 STYLE GUIDE FOR PYTHON CODE AUTHOR: GUIDO VAN ROSSUM @di_codes

Slide 11

Slide 11 text

PEP 20 THE ZEN OF PYTHON @di_codes

Slide 12

Slide 12 text

PEP 20 THE ZEN OF PYTHON AUTHOR: TIM PETERS @di_codes

Slide 13

Slide 13 text

PEP 566 METADATA FOR PYTHON SOFTWARE PACKAGES 2.1 @di_codes

Slide 14

Slide 14 text

PEP 566 METADATA FOR PYTHON SOFTWARE PACKAGES 2.1 AUTHOR: DUSTIN INGRAM @di_codes

Slide 15

Slide 15 text

1) DRAFT 2) ACCEPTANCE 3) IMPLEMENTATION @di_codes

Slide 16

Slide 16 text

1) DRAFT 2) ACCEPTANCE 3) IMPLEMENTATION @di_codes

Slide 17

Slide 17 text

1) DRAFT 2) ACCEPTANCE 3) IMPLEMENTATION @di_codes

Slide 18

Slide 18 text

BDFL DELEGATES @di_codes

Slide 19

Slide 19 text

@di_codes

Slide 20

Slide 20 text

PEP 572 ASSIGNMENT EXPRESSIONS @di_codes

Slide 21

Slide 21 text

:= @di_codes

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

No content

Slide 24

Slide 24 text

EXAMPLES @di_codes

Slide 25

Slide 25 text

BALANCING LOC AND BIG O() @di_codes

Slide 26

Slide 26 text

foo = [f(x), f(x)**2, f(x)**3] @di_codes

Slide 27

Slide 27 text

y = f(x) foo = [y, y**2, y**3] @di_codes

Slide 28

Slide 28 text

foo = [y := f(x), y**2, y**3] @di_codes

Slide 29

Slide 29 text

AVOIDING INEFFICIENT COMPREHENSIONS @di_codes

Slide 30

Slide 30 text

results = [] for x in data: result = f(x) if result: results.append(result) @di_codes

Slide 31

Slide 31 text

results = [ f(x) for x in data if f(x) ] @di_codes

Slide 32

Slide 32 text

results = [ y for x in data if (y := f(x)) ] @di_codes

Slide 33

Slide 33 text

UNNECESSARY VARIABLES IN SCOPE @di_codes

Slide 34

Slide 34 text

match = pattern.search(data) if match: do_something(match) @di_codes

Slide 35

Slide 35 text

if (match := pattern.search(data)): do_something(match) @di_codes

Slide 36

Slide 36 text

PROCESSING STREAMS IN CHUNKS @di_codes

Slide 37

Slide 37 text

chunk = file.read(8192) while chunk: process(chunk) chunk = file.read(8192) @di_codes

Slide 38

Slide 38 text

while chunk := file.read(8192): process(chunk) @di_codes

Slide 39

Slide 39 text

WHY? @di_codes

Slide 40

Slide 40 text

FEWER LINES ARE BETTER @di_codes

Slide 41

Slide 41 text

y = f(x) foo = [y, y**2, y**3] @di_codes

Slide 42

Slide 42 text

foo = [y := f(x), y**2, y**3] @di_codes

Slide 43

Slide 43 text

FEWER LINES ARE MORE EFFICIENT? @di_codes

Slide 44

Slide 44 text

match = re.match(data) group = match.group(1) if match else None @di_codes

Slide 45

Slide 45 text

group = re.match(data).group(1) if re.match(data) else None @di_codes

Slide 46

Slide 46 text

group = match.group(1) if (match := re.match(data)) else None @di_codes

Slide 47

Slide 47 text

= @di_codes

Slide 48

Slide 48 text

x = y = z = 0 # Yes (z := (y := (x := 0))) # No @di_codes

Slide 49

Slide 49 text

a[i] = x # Yes a[i] := x # No @di_codes

Slide 50

Slide 50 text

self.rest = [] # Yes self.rest := [] # No @di_codes

Slide 51

Slide 51 text

x = 1, 2 # Sets x to (1, 2) (x := 1, 2) # Sets x to 1 @di_codes

Slide 52

Slide 52 text

total += tax # Yes total +:= tax # No @di_codes

Slide 53

Slide 53 text

+:= @di_codes

Slide 54

Slide 54 text

No content

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

PEP 572 @di_codes

Slide 57

Slide 57 text

RECEPTION @di_codes

Slide 58

Slide 58 text

BACKWARDS COMPATIBILITY "WHERE WILL THIS WORK?" @di_codes

Slide 59

Slide 59 text

TEACHABILITY "WHAT DO WE CALL THIS?" @di_codes

Slide 60

Slide 60 text

ATTRACTIVENESS "IT'S JUST UGLY!" @di_codes

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

No content

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

TIM PETERS: "THE CURRENT PROPOSAL WOULD HAVE ALLOWED A MODEST BUT CLEAR IMPROVEMENT IN QUITE A FEW BITS OF CODE." @di_codes

Slide 65

Slide 65 text

BARRY WARSAW: "SINCE IT CHANGES THE SYNTAX OF THE LANGUAGE, PEOPLE TEND TO FOCUS ON THAT WITHOUT UNDERSTANDING THE DEEPER SEMANTIC ISSUES." @di_codes

Slide 66

Slide 66 text

ŁUKASZ LANGA: "DICTATORS SHOULD DICTATE" @di_codes

Slide 67

Slide 67 text

GUIDO VAN ROSSUM: HAD TO STOP READING THE THREADS SO HE WOULDN'T "GO INSANE" @di_codes

Slide 68

Slide 68 text

No content

Slide 69

Slide 69 text

No content

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

DICTATORS ARE PEOPLE TOO @di_codes

Slide 79

Slide 79 text

MAINTAINERS ARE PEOPLE TOO @di_codes

Slide 80

Slide 80 text

PEOPLE ARE PEOPLE TOO @di_codes

Slide 81

Slide 81 text

QUESTIONS @di_codes

Slide 82

Slide 82 text

WHAT DOES THIS MEAN FOR PYTHON? @di_codes

Slide 83

Slide 83 text

@di_codes

Slide 84

Slide 84 text

@di_codes

Slide 85

Slide 85 text

@di_codes

Slide 86

Slide 86 text

@di_codes

Slide 87

Slide 87 text

IT'S GOING TO BE OK @di_codes

Slide 88

Slide 88 text

PEP 8000 PYTHON LANGUAGE GOVERNANCE PROPOSAL OVERVIEW @di_codes

Slide 89

Slide 89 text

PEP 8001 PYTHON GOVERNANCE VOTING PROCESS @di_codes

Slide 90

Slide 90 text

PEP 8002 OPEN SOURCE GOVERNANCE SURVEY @di_codes

Slide 91

Slide 91 text

▸ PEP 8010 - The Technical Leader Governance Model ▸ PEP 8011 - Python Governance Model Lead by Trio of Pythonistas ▸ PEP 8012 - The Community Governance Model ▸ PEP 8013 - The External Governance Model ▸ PEP 8014 - The Commons Governance Model ▸ PEP 8015 - Organization of the Python community ▸ PEP 8016 - The Steering Council Model @di_codes

Slide 92

Slide 92 text

VOTE DEC 1ST - 16TH, 2018 @di_codes

Slide 93

Slide 93 text

No content

Slide 94

Slide 94 text

PEP 8016 STEERING COUNCIL MODEL @di_codes

Slide 95

Slide 95 text

VOTE JAN 21ST - FEB 4TH, 2019 @di_codes

Slide 96

Slide 96 text

. . . @di_codes

Slide 97

Slide 97 text

No content

Slide 98

Slide 98 text

No content

Slide 99

Slide 99 text

No content

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

Q&A @di_codes

Slide 102

Slide 102 text

WILL THIS BECOME PART OF PYTHON? @di_codes

Slide 103

Slide 103 text

IT ALREADY HAS (IN 3.8) @di_codes

Slide 104

Slide 104 text

BUT I DON'T LIKE IT! @di_codes

Slide 105

Slide 105 text

THEN DON'T WRITE IT! @di_codes

Slide 106

Slide 106 text

IS GUIDO COMING BACK? @di_codes

Slide 107

Slide 107 text

TO PYTHON? @di_codes

Slide 108

Slide 108 text

YES! @di_codes

Slide 109

Slide 109 text

AS BDFL? @di_codes

Slide 110

Slide 110 text

NOPE @di_codes

Slide 111

Slide 111 text

WILL THIS HAPPEN AGAIN? @di_codes

Slide 112

Slide 112 text

WILL ANOTHER PEP BE THIS CONTROVERSIAL? @di_codes

Slide 113

Slide 113 text

PROBABLY NOT @di_codes

Slide 114

Slide 114 text

WILL PEOPLE BE NEGATIVE ON THE INTERNET? @di_codes

Slide 115

Slide 115 text

¯\_(ϑ)_/¯ @di_codes

Slide 116

Slide 116 text

No content

Slide 117

Slide 117 text

THANKS! @DI_CODES