[Patches] [ python-Patches-820195 ] obj.__contains__() returns 1/0...

SourceForge.net noreply at sourceforge.net
Wed Oct 8 17:09:03 EDT 2003


Patches item #820195, was opened at 2003-10-08 15:52
Message generated for change (Comment added) made by gvanrossum
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=820195&group_id=5470

Category: Core (C code)
Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Wojtek Walczak (gminick)
Assigned to: Nobody/Anonymous (nobody)
Summary: obj.__contains__() returns 1/0...

Initial Comment:
shouldn't it return True/False?

examples:
>>> a = 'python'
>>> a.__contains__('perl')
0
>>> a.__contains__('python')
1
>>> a = { 'python' : 1, 'ruby' : 1 }
>>> a.__contains__('perl')
0
>>> a.__contains__('python')
1
>>>

instead of:

>>> a = 'python'
>>> a.__contains__('perl')
False
>>> a.__contains__('python')
True
>>> a = { 'python' : 1, 'ruby' : 1 }
>>> a.__contains__('perl')
False
>>> a.__contains__('python')
True
>>>

The reason for asking is that i.e. obj.__eq__() returns True/False,
and besides True/False looks nicer than 1/0 ;>

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2003-10-08 17:09

Message:
Logged In: YES 
user_id=6380

Thanks, checked in!

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2003-10-08 16:12

Message:
Logged In: YES 
user_id=6380

Looks good, I'll check this in.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=820195&group_id=5470



More information about the Patches mailing list