Vue d'ensemble

attrs 24.1, publié le 3 août 2024, rend le premier argument de evolve() positional-only.

Fonctionnalités principales

evolve() positional-only

Le premier argument de evolve() est désormais positional-only, évitant les conflits avec les attributs nommés inst.

python
import attrs

@attrs.define
class Config:
    host: str = 'localhost'
    port: int = 8000

cfg = Config()
# evolve() avec premier arg positional-only
new_cfg = attrs.evolve(cfg, port=9000)
print(new_cfg)  # Config(host='localhost', port=9000)

Sources