PEP 335: Overloadable Boolean Operators - Official Posting

Gerrit gerrit at nl.linux.org
Sat Sep 11 11:57:22 CEST 2004


Colin J. Williams wrote:
> I understand that the intent, eventually, is that the basic types become 
> classes.
> 
> Would making Bool a class permit the achievement of these objectives?
> 
> If Bool were a class, then subclasses could use __repr__ to provide 
> alternative responses to False/True, such as No/Yes or Fail/OK.

No, this has nothing to do with it. The representation is not the issue.
The issue is that currently, 'a and b' returns either a or b. Suppose we
have an array A = [a1, b1, c1], B = [a2, b2, c2], A and B will currently
always return A. However, we may want it to return [a1 and a2, b1 and
b2, c1 and c2]. That is what this PEP is about.

The lack op ability to subclass bool is something different. I don't
know why that is.

regards,
Gerrit.

-- 
Weather in Twenthe, Netherlands 11/09 11:25:
	19.0°C   wind 4.0 m/s SSW (57 m above NAP)
-- 
Gerrit Holl - 2nd year student of Applied Physics, Twente University, NL.
Experiences with Asperger's Syndrome:
	EN http://topjaklont.student.utwente.nl/english/
	NL http://topjaklont.student.utwente.nl/



More information about the Python-list mailing list