__eq__ and sets

Chris Reedy creedy at mitretek.org
Tue Feb 25 20:29:52 CET 2003


Alex Martelli wrote:
> Chris Reedy wrote:
> 
> 
>>I recently encountered the following:
>>
>> >>> from sets import Set
>> >>> x = Set([1])
>> >>> x == 2
>>TypeError: Binary operation only permitted between sets
>>
>>The TypeError is raised by Set.__eq__ (actually BaseSet.__eq__) upon
>>recognizing that 2 is not a set.
>>
>>My question: Is this the expected and/or appropriate behavior?
> 
> 
> I'm not quite sure why all binary operations in sets.py raise
> TypeError when the other argument is not a set -- it was that
> way when I started working on it and I did not question it.  I
> think you should submit a bug report to SF so the BDFL can
> Pronounce on it...
> 
> 
> Alex
> 
Ok. Done.

-- 
This is informal and not an official Mitretek Systems position.
Dr. Christopher L. Reedy, Senior Principal Software Engineer
Mitretek Systems, 3150 Fairview Park Drive South, Falls Church, VA 
22042-4519
Email: creedy at mitretek.org  Phone: (703) 610-1615  FAX: (703) 610-2203



-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----




More information about the Python-list mailing list