... na minha visão
assert
r''
).clear()
, .copy()
, .update()
, .get()
[expression] and [on_true] or [on_false]
"Vamos fazer um browser em Python!"
Django 1.0: 2008
"É mais fácil pra mim vender AJAX e Rails do que Flash e Python."
-- Tilefile CEO
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
"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:
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)
Relaxing Grammar Restrictions On Decorators (PEP 614)
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."