Skip to content

Conversation

dralley
Copy link
Contributor

@dralley dralley commented Nov 21, 2019

No description provided.

@dralley dralley force-pushed the itertools branch 2 times, most recently from 05a134d to 3b5816a Compare November 21, 2019 17:53
let iter = get_iter(vm, &iterable)?;
let pool = get_all(vm, &iter)?;

if r < 0 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep r as usize, but then I don't have control over ValueError being returned when a negative value is passed in, it comes out as OverflowError instead. Is there a better way?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could make a new type that implements TryFromObject that stores a num_bigint::Sign and a usize. I can see that being useful in other places as well like sequence indexing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ended up just copying what some of the other implementations are doing to keep it consistent. If it's usable in many places it probably makes sense as a separate improvement.

@dralley dralley force-pushed the itertools branch 2 times, most recently from dfae03d to 455d8d6 Compare November 22, 2019 02:19
@coolreader18 coolreader18 merged commit 389db55 into RustPython:master Nov 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants