Yes, maybe I can use that.
With Python >= 3.6, also
def f() -> typing.NamedTuple("__f", x=int, y=int): ...
which is concise, but a slightly weird abuse.
But there are other drawbacks:
>>> typing.Tuple[int, int]
typing.Tuple[int, int]
>>> typing.Tuple[int, int] is typing.Tuple[int, int]
True
ve
On 7/29/19 4:36 PM, Christian Tismer wrote:
Hi friends,
I am meanwhile the PySide maintainer at The Qt Company,
and we are trying to make the mapping from Qt functions
to Python functions as comparable as possible.
One problem are primitive pointer variables:
In Qt, it is natural to use "somety
On Tue, 30 Jul 2019 at 09:33, Christian Tismer wrote:
> >>> typing.NamedTuple("__f", x=int, y=int)
>
> >>> typing.NamedTuple("__f", x=int, y=int) is typing.NamedTuple("__f",
> x=int, y=int)
> False
This appears to go right back to collections.namedtuple:
>>> from collections import namedtuple
>
I think I have to agree with Petr. Define explicit type names.
On Tue, Jul 30, 2019 at 2:45 AM Paul Moore wrote:
> On Tue, 30 Jul 2019 at 09:33, Christian Tismer
> wrote:
> > >>> typing.NamedTuple("__f", x=int, y=int)
> >
> > >>> typing.NamedTuple("__f", x=int, y=int) is typing.NamedTuple("__f
Hi Petr, hi Paul,
the struct sequence objects are in fact interesting!
About the "every instance" issue:
Well, if I used something like the caching approach from Paul's post,
like
cached_namedtuple = lru_cache(None)(namedtuple)
n1 = cached_namedtuple('f', ('a', 'b', 'c'))
n2 = cache