[OpenSCAD] DEPRECATED: Using ranges of the form [begin:end] with begin value greater than the end value is deprecated.
A. Craig West
acraigwest at gmail.com
Wed May 22 09:15:57 EDT 2019
I can't actually think of a single use case for failing on a zero length
list. Most of the time I run across this writing various filter and
transformation functions usin list comprehensions, and they all start with
what should be an unnecessary :
len(v) == 0 ?  :
[ for (o = v)...]
On Wed, 22 May 2019, 09:02 Doug Moen, <doug at moens.org> wrote:
> In my opinion, this is just a bug that should be fixed. I believe that
> there is a lot more code out there that is broken by this behaviour, than
> there is code that depends on this behaviour. So fixing the bug will fix
> more programs than it breaks.
> On Wed, May 22, 2019, at 7:47 AM, adrianv wrote:
> > Every so often I get this warning message.
> > DEPRECATED: Using ranges of the form [begin:end] with begin value greater
> > than the end value is deprecated.
> > It means my code has a bug, because I *never* write [5:0] to mean
> > don't understand why anybody thought that was a good idea---so it means
> > potentially getting some non-empty list when I should be getting the
> > list as a result.
> > The fix is easy: rewrite [a:b] as [a:1:b]. And I guess I should try to
> > in the habit of never writing [a:b] and just always writing [a:1:b] to
> > prevent this problem in the future. But I get no hint as to where in my
> > code the problem is, which makes it kind of troublesome to track down.
> > there any way to get more information?
> > --
> > Sent from: http://forum.openscad.org/
> > _______________________________________________
> > OpenSCAD mailing list
> > Discuss at lists.openscad.org
> > http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
> OpenSCAD mailing list
> Discuss at lists.openscad.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Discuss