[Numpy-discussion] why does b[:-0] not work, and is there an elegant solution?
Wed Aug 19 20:22:48 CDT 2009
On Wed, Aug 19, 2009 at 5:50 AM, Neil Martinsen-Burrell<email@example.com> wrote:
> On Aug 19, 2009, at 7:25 AM, Mark Bakker wrote:
>> I compute the index of the last term in an array that I need and
>> call the index n.
>> I can then call the array b as
>> If I need all terms in the array, the logical syntax would be:
>> but that doesn't work. Any reason why that has not been implemented?
>> Any elegant workaround?
> Because there is no negative zero as an integer:
> >>> -0 == 0
Not that it matters for the discussion, but -0.0 == 0.0:
x = np.array(np.PZERO)
y = np.array(np.NZERO)
y == x # True
1 / x == 1 / y # False: inf and negative inf
The only way to differentiate the number by itself is signbit,
More information about the NumPy-Discussion