[PATCH v2 1/4] usertools/cpu_layout: update coding style

Robin Jarry rjarry at redhat.com
Tue Aug 20 11:20:06 CEST 2024


Burakov, Anatoly, Aug 20, 2024 at 11:12:
> > FYI: if we change the minimum supported python version to 3.9, we could 
> > even get rid of this import completely as builtin types `set`, `list`, 
> > `tuple` and `dict` have become subscriptable.
> > 
> >     https://peps.python.org/pep-0585/
> > 
> > You can use them directly instead of the symbols defined in the typing 
> > module. E.g. the following becomes valid syntax:
> > 
> >     def foo(a: list[set[int]]) -> dict[str, tuple[str]]:
> > 
> > Instead of the more verbose:
> > 
> >     def foo(a: T.List[T.Set[int]]) -> T.Dict[str, T.Tuple[str]]:
> > 
> > But we can keep that for another day.
> > 
>
> Incidentally, `dpdk-pmdinfo.py` script does use this syntax already. So 
> either our minimum Python requirement is already met for this, or 
> pmdinfo needs to be fixed to avoid it.

I checked and unless I missed something, dpdk-pmdinfo.py uses the 
symbols from the typing module for annotations. Not builtin container 
types.

But I think that we should bump the minimum python version to 3.9. 3.6 
is really old...



More information about the dev mailing list