[Numpy-discussion] Proposal: "intrange" for inclusive integer intervals

2023-05-04 Thread cameron . pinnegar
Getting a closed interval is awkward. Let's say you want an array of the integers from a to b, inclusive at both ends. e.g. for a=10 b=15, you want: [10, 11, 12, 13, 14, 15] Neither linspace nor arange makes this easy. arange(a, b) # wrong, it only goes up to 14 arange(a, b+1) # right, but awkw

[Numpy-discussion] Allow for callable in indexing

2021-11-24 Thread cameron . pinnegar
If you have an array built up out of method chaining, sometimes you need to filter it at the very end. This can be annoying because it means you have to create a temporary variable just so you can refer to it in the indexing square brackets: _temp = long_and_complicated_expression() result = _t