Hi Caleb, 

On Tue, Feb 23, 2021 at 11:05 PM Caleb Donovick <donovick@cs.stanford.edu> wrote:
What is the motivation for returning `None` on empty splits?  I feel like this creates an unnecessary asymmetry.  I don't personally have a use case for the this feature so I may be missing something but it seems like it would force an annoying pattern:

Split is used by the interpreter to implement except*. It needs to check whether the first value of the split is empty or not (this determines whether the except* clause executes). 
This is more efficiently done with None. And then there is creating an object that you don't need. 

The intention is that you use except* rather than do this:
except ExceptionGroup as eg:
    g1, g2 = eg.split(predicate)
    for e in g1:
    for e in g2:

(as an aside - exception groups ended up not being iterable - that is one of the rejected ideas, see explanation there).
Also this creates an subtle difference with subgroup:

g1, g2 = eg.split(predicate)
h1, h2  = eg.subgroup(predicate), eg.subgroup(lambda e: not predicate(e))
assert g1 == h1 and g2 == h2 # only true if `None not in {g1, g2}`

An empty subgroup should also return None. I see this is not mentioned in the PEP, so I will add it. Thanks.