Update a map() in make_inventory() to also work with Python3 (using a for loop - more readable and concise):
The syntax for tuple parameters in lambda functions has been removed in Python3 and must be replaced:
This code iterates over the inventory dictionary using the items() method and unpacks each key-value pair into k and v. Then, it calls the inventory_entry() function with the appropriate arguments.
In general, map() is useful when you want to apply a function to every item of an iterable and return a list of the results.
However, if you only need to iterate over the items of an iterable and perform some operation on each item, a for loop is often more readable and concise than using map().
Established for Python3 migration with a recent Python3 merge for xsconsole:
Replacing such map() loops with a for loop has already been established with the recently merged equivalent Python3 commit for xsconsole.
CI Tests of this code:
The functionality of this code is already tested by each of the test cases in tests/integration/ as all of them validate the contents and XML schema of bugtool-output/inventory.xml
Update a
map()
inmake_inventory()
to also work with Python3 (using a for loop - more readable and concise):The syntax for
tuple
parameters inlambda
functions has been removed in Python3 and must be replaced:This code iterates over the inventory dictionary using the items() method and unpacks each key-value pair into k and v. Then, it calls the inventory_entry() function with the appropriate arguments.
In general, map() is useful when you want to apply a function to every item of an iterable and return a list of the results.
However, if you only need to iterate over the items of an iterable and perform some operation on each item, a for loop is often more readable and concise than using map().
Established for Python3 migration with a recent Python3 merge for xsconsole:
Replacing such map() loops with a for loop has already been established with the recently merged equivalent Python3 commit for xsconsole.
CI Tests of this code:
The functionality of this code is already tested by each of the test cases in tests/integration/ as all of them validate the contents and XML schema of bugtool-output/inventory.xml