This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients AlexWaygood, FHTMitchell, JelleZijlstra, dlukes, eric.smith, graingert, gvanrossum, kj, levkivskyi, python-dev, rhettinger, serhiy.storchaka, sobolevn
Date 2022-03-05.17:33:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <[email protected]>
In-reply-to
Content
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.
History
Date User Action Args
2022-03-05 17:33:51gvanrossumsetrecipients: + gvanrossum, rhettinger, eric.smith, python-dev, serhiy.storchaka, graingert, levkivskyi, dlukes, JelleZijlstra, FHTMitchell, sobolevn, kj, AlexWaygood
2022-03-05 17:33:51gvanrossumsetmessageid: <[email protected]>
2022-03-05 17:33:51gvanrossumlinkissue43923 messages
2022-03-05 17:33:51gvanrossumcreate