Quelqu'un peut-il s'il vous plaît expliquer le «-5» ci-dessous. Je suis un peu nouveau pour numpy, mais cela semble bizarreComportement de gamme en python et arange en numpy
In [112]: an_int=9
In [113]: an_int/2
Out[113]: 4
In [114]: range(-an_int/2,an_int/2)
Out[114]: [-5, -4, -3, -2, -1, 0, 1, 2, 3]
In [115]: arange(-an_int/2,an_int/2)
Out[115]: array([-5, -4, -3, -2, -1, 0, 1, 2, 3])
In [116]: range(-4,4)
Out[116]: [-4, -3, -2, -1, 0, 1, 2, 3]
De plus, l'opérateur unaire '-' a [priorité supérieure] (http://docs.python.org/reference/expressions.html#summary) sur'/'. Donc '-a/b' est' (-a)/b', pas '- (a/b)'. – Avaris
@Avaris - bon point. – mgilson