title: Efficient date range overlap calculation?
body: <p>I have two date ranges where each range is determined by a start and end date (obviously, <code>datetime.date</code> instances). The two ranges can overlap or not. I need the number of days of the overlap. Of course I can pre-fill two sets with all dates within both ranges and the perform a set intersection but this is possibly inefficient...is there a better way apart from another solution using a long <code>if</code>-<code>elif</code> section covering all cases?</p>