[Python-ideas] Fwd: Anonymous namedtuples

Joseph Martinot-Lagarde contrebasse at gmail.com
Tue Apr 19 18:02:55 EDT 2016


> On 19.04.2016 19:35, Guido van Rossum wrote:
> > That's essentially what the (x=12, y=16) proposal is about, IIUC -- it 
> > would just be a single new type, so (x=12, y=16).__class__ would be 
> > the same class object as (a='', b=3.14).
> 
> The proposal reminds me of JavaScript's "object".
> 
> So, "(x=12, y=16).__class__ == type(object())"?

No, it would have its own class but it would be the same for all of these
object, independently of the fields. This is different from namedtuples who
need the creation of a subclass for each set of fields.



More information about the Python-ideas mailing list