[SciPy-user] Array Bounds

Peter Wang pwang@enthought....
Fri Mar 9 13:18:09 CST 2007


On Mar 9, 2007, at 12:07 PM, Robert Kern wrote:

>> In case one should not like it, can it be changed by the user?
>
> No.

Well, this is not strictly true.  The range() function is a built-in,  
but you can override it by defining your own that includes the final  
index:

def range(a,b):
     return __builtins__.range(a,b+1)

 >>> range(1,5)
[1, 2, 3, 4, 5]


Of course, you should NEVER do this.  Other people that catch you  
redefining built-in functions will probably call you all sorts of bad  
names.


-Peter


More information about the SciPy-user mailing list