On Mon, Jul 29, 2019 at 07:19:42PM -0700, Guido van Rossum wrote:
> On Mon, Jul 29, 2019 at 6:55 PM Ricky Teachey <ri...@teachey.org> wrote:
> [Steven]
> 
> > If the core developers don't consider namedtuples important enough to
> >> get syntactic support, I doubt that namespaces will.
[...]

> Except it's wrong. The successor of namedtuple is typing.NamedTuple which
> supports this syntactically. From the [docs](
> https://docs.python.org/3/library/typing.html#typing.NamedTuple):
> ```
> class Employee(NamedTuple):
>     name: str
>     id: int
> ```

Oh that's nice!

I thought that typing.NamedTuple was only for type annotations, I had no 
idea you could use it for actual named tuples.

Should it be aliased in collections if we want people to consider 
using it instead of namedtuple? I would never go looking in typing for 
non-annotation-related uses, and I'm probably not the only one.

In any case, that's still using existing syntax (class statement), 
not a dedicated new "NamedTuple" keyword. And if there's no NamedTuple 
keyword, we shouldn't expect a Namespace keyword either :-)



-- 
Steven
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/SXF3RKYQ6DXFKX2RFMUDUKAWQEGXGHP3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to