Guido van Rossum <gu...@python.org> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43923>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to