This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dominick Johnson
Recipients Dominick Johnson
Date 2020-01-23.18:12:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1579803167.84.0.997525929027.issue39437@roundup.psfhosted.org>
In-reply-to
Content
I would love to see collections.Counter support scalar multiplication.

## My Use Case:

I am writing a python script to manage hardware selections for custom-build computers. Users are able to select various options from a web interface, and the script compiles a list of parts that need purchased.

Each option for user selection has a corresponding Counter object to keep track of what parts are needed for that selection. For example, the user option "i5 Processor" would have a corresponding counter that might looks roughly like this: {"i5-xxxx": 1, "xxxxx Motherboard"}. A user option for "2 TB RAID 10" might have {"1 TB HDD": 4}.

The script adds all the counters for the selected options together to produce a counter detailing the full parts list for the build.

I'd like to add a feature to the script that allows the user to also specify a quantity for certain selections. (Maybe the user wants 2 1TB Storage Drives without any kind of RAID setup). It would be really convenient to be able to simply multiply the selection's counter by it's quantity before adding it to the main counter. e.g. `main_counter += secondary_counter * selection_quantity`

This seems like an extremely simple feature to add, and I would of course be willing to add it myself as long as the Python team is willing to accept a pull request from me adding this feature. However, I've never contributed to such a large project before, so I'm not sure what kind of procedures are in place to make it happen.
History
Date User Action Args
2020-01-23 18:12:47Dominick Johnsonsetrecipients: + Dominick Johnson
2020-01-23 18:12:47Dominick Johnsonsetmessageid: <1579803167.84.0.997525929027.issue39437@roundup.psfhosted.org>
2020-01-23 18:12:47Dominick Johnsonlinkissue39437 messages
2020-01-23 18:12:47Dominick Johnsoncreate