Message414589
Okay, that's a sensible use case.
I do doubt your intuition of preferring named tuples over dataclasses a bit. This seems to encourage premature optimization. I'd say for simple cases use plain tuples (most performant), for complex cases use dataclasses (named fields and many other features that you may eventually want).
Compare concurent.futures.wait()'s return type (a named tuple) to asyncio.tasks.wait()'s return type (a plain tuple). I don't think that naming the fields of the return tuple (awkwardly :-) makes the c.f.wait() API easier to understand than the asyncio.wait() API.
Maybe named tuples, like typed dicts, are "in-between" solutions on the spectrum of data types (tuple - named tuple - dataclass; dict - typed dict - dataclass), and we should encourage people to use the neighboring solutions instead.
I'd rather spend efforts making dataclasses faster than adding features to named tuples. |
|
| Date |
User |
Action |
Args |
| 2022-03-05 17:33:51 | gvanrossum | set | recipients:
+ gvanrossum, rhettinger, eric.smith, python-dev, serhiy.storchaka, graingert, levkivskyi, dlukes, JelleZijlstra, FHTMitchell, sobolevn, kj, AlexWaygood |
| 2022-03-05 17:33:51 | gvanrossum | set | messageid: <[email protected]> |
| 2022-03-05 17:33:51 | gvanrossum | link | issue43923 messages |
| 2022-03-05 17:33:51 | gvanrossum | create | |
|