[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
> [0:5]---I
> > don't understand why anybody thought that was a good idea---so it means
> I'm
> > potentially getting some non-empty list when I should be getting the
> empty
> > list as a result.
> >
> > The fix is easy: rewrite [a:b] as [a:1:b].  And I guess I should try to
> get
> > 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.
> Is
> > 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
> http://lists.openscad.org/mailman/listinfo/discuss_lists.openscad.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscad.org/pipermail/discuss_lists.openscad.org/attachments/20190522/5c287059/attachment.html>


More information about the Discuss mailing list