New submission from Dominick Johnson <domin...@techrisdesign.com>:

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.

----------
components: Library (Lib)
messages: 360573
nosy: Dominick Johnson
priority: normal
severity: normal
status: open
title: collections.Counter support multiplication
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39437>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to