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

Burakov, Anatoly anatoly.burakov at intel.com
Tue Aug 20 11:31:53 CEST 2024


On 8/20/2024 11:20 AM, Robin Jarry wrote:
> 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.

It does both. Check e.g. line 147:

def scrub_pci_ids(info: dict):

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

Well, that's not really up to me to decide :)

-- 
Thanks,
Anatoly



More information about the dev mailing list