[Python-ideas] exclusively1, common, exclusively2 = set1 - set2, set1 & set2, set2 - set1

Paddy3118 paddy3118 at gmail.com
Sat Jul 6 06:56:00 CEST 2013


On Friday, 5 July 2013 22:38:22 UTC+1, Joshua Landau wrote:
>
> ...
>
 

> Hence why it should be defined: 
>
>     set1.partition(set2) === set1 - set2, set1 & set 2 
>
> That lets you have the "single pass" of each set as before, but is a 
> "smaller" operation. The full partition would just plot "set2 - set1" 
> on the end: 
>
> ven_a, ven_shared = a.partition(b) 
> ven_b = ven_b - ven_shared 
>
> And "ven_a | ven_shared == a" as you said. 
> _______________________________________________ 
>

Unfortunately I tend to need all three of  exclusively1, common, 
exclusively2 . Assuming fast C implementations, then your proposal would 
lead to less opportunity for optimization and the need to create one needed 
result in Python. The need for all three and the potentially better 
optimization afforded to computing three at once in C should outweigh any 
considerations of the name of the method.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130705/ab27b6e0/attachment.html>


More information about the Python-ideas mailing list