ANN: intervalset Was: Set type for datetime intervals

Michael Selik michael.selik at gmail.com
Wed Apr 6 03:34:43 EDT 2016


On Tue, Apr 5, 2016, 10:46 PM Nagy László Zsolt <gandalf at shopzeus.com>
wrote:

>
> >> How about creating two classes for this? One that supports zero sized
> >> intervals, and another that doesn't?
> > If you don't want zero sized intervals, just don't put any in it. You
> > don't have a separate list type to support even integers vs one that
> > supports all floats. What operations are made different in
> > implementation by this restriction?
> When you substract two sets, zero sized intervals may appear in the
> result. It is not just a question of "putting or not putting them in".
> Are zero sized intervals valid or not? In my particular application,
> they are not. I think Michael was right: this cannot be generalized. It
> is application dependent.
>

To emphasize that in your project, I'd keep the interval code in the same
module you have the time calculations, rather than breaking it into a more
generic sounding module. Once you relax your goals, you might not even need
a class, just one or a few functions.

>



More information about the Python-list mailing list