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

Steven D'Aprano steve at pearwood.info
Mon Jul 8 09:22:46 CEST 2013


On Sun, Jul 07, 2013 at 02:37:56PM -0700, David Mertz wrote:
> On Jul 7, 2013 2:09 PM, "Eric V. Smith" <eric at trueblade.com> wrote:
> >
> > On 7/7/2013 1:45 AM, David Mertz wrote:
> > > Maybe the generalization isn't worthwhile.  I was thinking that maybe a
> > > more general version should keep order in types that have order to start
> > > with, so I confess I'm not certain what the "correct" interface would
> be.
> > >
> > > But even if it were only for sets, I like the idea of a plain function
> > > much better than a method of a set, even if the only arguments it
> > > accepted were sets.
> >
> > If it were added, I think a classmember on set would be reasonable.
> 
> I agree.

A class member? Do you mean a class *method*?

I think it would be freaky and weird if I did this:

some_set.venn_split(second_set, another_set)

(for lack of a better name) and the value of some_set was ignored. Class 
methods are okay for things like alternate constructors, but I don't 
think they are appropriate here.



-- 
Steven


More information about the Python-ideas mailing list