10000 irange() when used with neg · Issue #235 · grantjenks/python-sortedcontainers · GitHub
[go: up one dir, main page]

Skip to content

irange() when used with neg #235

@oedokumaci

Description

@oedokumaci

I am using SortedDict with neg from operators (so that index 0 is lowest key, value pair). The thing is that when I use irange, I need to swap minimum and maximum values to get what I would normally expect. Is this intended?

MWE below:

bid_prices_and_quantities = SortedDict(neg)
bid_prices_and_quantities[1.5] = 5
bid_prices_and_quantities[2.5] = 4
bid_prices_and_quantities[3] = 3
bid_prices_and_quantities[4] = 2
for price in bid_prices_and_quantities.irange(minimum=2, maximum=3):
    print(price)

this does not print anything.

for price in bid_prices_and_quantities.irange(maximum=2, minimum=3):
    print(price)

this prints as expected:
3
2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0