
On 25 July 2017 at 02:46, Michel Desmoulin <desmoulinmichel@gmail.com> wrote:
Le 24/07/2017 à 16:12, Nick Coghlan a écrit :
On 22 July 2017 at 01:18, Guido van Rossum <guido@python.org> wrote:
Honestly I would like to declare the bare (x=1, y=0) proposal dead. Let's encourage the use of objects rather than tuples (named or otherwise) for most data exchanges. I know of a large codebase that uses dicts instead of objects, and it's a mess. I expect the bare ntuple to encourage the same chaos.
This is the people working on big code base talking.
Dedicated syntax: (x=1, y=0) New builtin: ntuple(x=1, y=0) So the only thing being ruled out is the dedicated syntax option, since it doesn't let us do anything that a new builtin can't do, it's harder to find help on (as compared to "help(ntuple)" or searching online for "python ntuple"), and it can't be readily backported to Python 3.6 as part of a third party library (you can't easily backport it any further than that regardless, since you'd be missing the order-preservation guarantee for the keyword arguments passed to the builtin). Having such a builtin implictly create and cache new namedtuple type definitions so the end user doesn't need to care about pre-declaring them is still fine, and remains the most straightforward way of building a capability like this atop the underlying `collections.namedtuple` type. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia