Skip to content

allow weights in random.choice #63044

@aisaac

Description

@aisaac
mannequin
BPO 18844
Nosy @tim-one, @rhettinger, @mdickinson, @pitrou, @serhiy-storchaka, @NeilGirdhar, @applio
PRs
  • [Do Not Merge] Convert Misc/NEWS so that it is managed by towncrier #552
  • Files
  • weighted_choice.diff: Preliminary implementation of random.choice optional arg "weights"
  • weighted_choice_v2.diff: Move cumulative distribution calculation to separate function that returns an index generator
  • weighted_choice_generator.patch
  • wcg_bench.py: Benchmarking different methods
  • weighted_choice_generator_2.patch
  • weighted_choice_v3.diff: a new implementation of weighted choice
  • weighted_choice_v3.patch: weighted choice function
  • weighted_choice_v4.patch
  • weighted_choice_v5.patch: weighted choice function v5
  • weighted_choice.diff
  • weighted_choice2.diff: Add docs and test
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/rhettinger'
    closed_at = <Date 2016-09-07.00:17:01.460>
    created_at = <Date 2013-08-26.17:23:45.101>
    labels = ['type-feature', 'library']
    title = 'allow weights in random.choice'
    updated_at = <Date 2017-03-31.16:36:29.131>
    user = 'https://bugs.python.org/aisaac'

    bugs.python.org fields:

    activity = <Date 2017-03-31.16:36:29.131>
    actor = 'dstufft'
    assignee = 'rhettinger'
    closed = True
    closed_date = <Date 2016-09-07.00:17:01.460>
    closer = 'rhettinger'
    components = ['Library (Lib)']
    creation = <Date 2013-08-26.17:23:45.101>
    creator = 'aisaac'
    dependencies = []
    files = ['31479', '31547', '31732', '31734', '36331', '42322', '42323', '42386', '42393', '44394', '44407']
    hgrepos = []
    issue_num = 18844
    keywords = ['patch', 'needs review']
    message_count = 69.0
    messages = ['196229', '196234', '196235', '196252', '196551', '196567', '196709', '196711', '196716', '196721', '196728', '196731', '196741', '196750', '196761', '196767', '197507', '197512', '197540', '197862', '197865', '197866', '198367', '198372', '223750', '224947', '224949', '224953', '224954', '224957', '225128', '225133', '225137', '225140', '225148', '226891', '262625', '262626', '262642', '262649', '262652', '262656', '262678', '262744', '262967', '262970', '262971', '262981', '262982', '262983', '262994', '262995', '267782', '272767', '272785', '274538', '274677', '274684', '274686', '274760', '274907', '274964', '277485', '277486', '277487', '278516', '278633', '279701', '279702']
    nosy_count = 14.0
    nosy_names = ['tim.peters', 'rhettinger', 'mark.dickinson', 'pitrou', 'aisaac', 'westley.martinez', 'python-dev', 'serhiy.storchaka', 'NeilGirdhar', 'madison.may', 'dkorchem', 'Christian.Kleineidam', 'davin', 'xksteven']
    pr_nums = ['552']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'patch review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue18844'
    versions = ['Python 3.6']

    Metadata

    Metadata

    Assignees

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions