Re: [RFC] Define proper semantics for range() function

From: Date: Thu, 30 Mar 2023 13:55:37 +0000
Subject: Re: [RFC] Define proper semantics for range() function
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-119790@lists.php.net to get a copy of this message
> > I've changed the behaviour to throw a ValueError if a negative step is > provided with increasing range and accept negative steps for decreasing > ranges. > I am not sure this is better. This would introduce a BC break because now it's not as easy to avoid the error as you can't just wrap the variable in abs() call. I am not sure why we are even treating this as an error. It looks to me like PHP already copes with this whether it's a positive or negative number. If we just want to inform the user that the sign has no meaning, we can raise a Notice and leave it at that. It's not wrong that the step is negative, it's just a pointless sign.

« previous php.internals (#119790) next »