2.2 features

Paul Prescod paulp at ActiveState.com
Wed Aug 1 12:15:27 EDT 2001


Guido van Rossum wrote:
> 
>....
> 
> Sorry, this isn't worth adding new syntax.  The 'in' thing worked
> because a in b is already mapped to b.__contains__(a).

First, you may be right that it isn't worth adding new syntax but it
also isn't worth abusing existing syntax. Types are usually nouns that
do NOT directly represent sets. "int" is different from "the set of
ints" and "programmer" different from the "set of programmers".

Second, I think that this might be worth adding new syntax for one
reason. The current syntax for exception-type trapping is extremely
error prone and nasty and it is essentially the same problem. I could
imagine:

try:
    foo()
except exc isa OverflowError, ZeroDivisionError:
    pass

Nevertheless, I'd rather see the abuse of "in" removed even if it leaves
the exception problem untouched.

-- 
Take a recipe. Leave a recipe.  
Python Cookbook!  http://www.ActiveState.com/pythoncookbook




More information about the Python-list mailing list