PyCaxias 2020

Me
  • Co-coordenador do meetup PyTche
  • Coordenador do meetup Rust in POA
  • Co-coordenador do meetup Design de Código
  • Palestrante do Tchelinux

JulioBiason.me

"Coisas Que Eu Aprendi Na Marra (Em 30 Anos de Desenvolvimento de Software)

😞

Python: Passado, Presente e Futuro

... na minha visão

O Passado

Python 1.5

Python 1.5 (1998)

  • assert
  • raw strings (r'')
  • Novos métodos de dicionários: .clear(), .copy(), .update(), .get()

[expression] and [on_true] or [on_false]

"Vamos fazer um browser em Python!"

  • Web Server
  • Storage: Pickle
  • Atualizado storage: MySQL
  • Criada toda uma camada para que o carregamento parecesse com leitura de pickles

Django 1.0: 2008

"É mais fácil pra mim vender AJAX e Rails do que Flash e Python."

-- Tilefile CEO

O Presente

O Futuro

You can't connect the dots looking forward; you can only connect them looking backwards.

-- Steve Jobs

No man is an island,
Entire of itself,
Every man is a piece of the continent,
A part of the main.

-- John Donne

Type Hinting: Love it

"Mas Python não tem tipos!"


In [1]: type(object)
Out[1]: type
                    

In [4]: type("a")
Out[4]: str

In [5]: type(str)
Out[5]: type
                    

def to_fahrenheit(temperature: int) -> int:
					

@dataclass
class Celcius:
    temperature: int


def to_fahrenheit(temperature: Celcius) -> int:
                    

mypy

??

None-aware operator (PEP 505)


a ??= 'value'
                    

a = a if a is not None else 'value'
                    

@

Dedicated infix operator for matrix multiplication (PEP 465)

|

Union Operator to Dict (PEP 584)


dict1.update(dict2)     # in-place
                    

dict3 = dict1 | dict2
                    

dict1 |= dict2          # same as .update()
                    

:=

Assignment Operator (PEP 572)


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

@dict[key].attr[0].decorator

Relaxing Grammar Restrictions On Decorators (PEP 614)

Steering Council 🤔

Python Positional-Only Parameters (PEP 570)


pow(x, y, z=None, /)
...

>>> pow(x=5, y=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: pow() takes no keyword arguments
                    

"Without the ability to specify which parameters are positional-only, library authors must be careful when choosing appropriate parameter names."

🤦

??