Guido van Rossum schrieb: > Can anyone who is in favor of changing this please come up with a spec > for the new bool() signature? What would you do for the most common > use case of bool(), which is converting an arbitrary value to its > Boolean equivalent without using an if test or the "not not x" hack?
I think this subthread doesn't propose to change bool(), but only to stop inheriting bool from int, while giving bools an __index__ method that returns 0 or 1 to still allow them being used as list indices. The obvious consequence would be that arithmetic wouldn't work any longer with bools involved. Also, mapping access or set membership wouldn't work like now, >>> d = {1: 2} >>> d[True] 2 >>> True in set([1]) True but that would only be logical. Georg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com