[Python-ideas] universal set object for use in set manipulation

Nick Coghlan ncoghlan at gmail.com
Thu Jul 23 23:08:34 CEST 2009


Steven D'Aprano wrote:
> Firstly, if it raises an exception, then it means all set handling code 
> needs to be written (e.g.):
> 
> try:
>     len(s)
> except Exception:
>     # handle universal set
>     print "What do I do here?"
> 
> 
> instead of the simple:
> 
> len(s)

There is a lot of floating point code in the world that will blow up if
fed a Nan or an Inf value as input. Given that it is even harder for a
set.universal() instance to show up by accident, I don't see that it
would be a major problem if most set handling code remained "naive"
about the universal set.

That said, I'm still with Georg in not being convinced yet that the
mathematical elegance is worth the additional complexity.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------



More information about the Python-ideas mailing list