2.2 features

Guido van Rossum guido at zope.com
Wed Aug 1 19:37:56 CEST 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".

Linguistically, yes.  But mathematically, describing a type as a set
of values is often used (and it explains a subtype as a subset of a
type).

> 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

I find 'isa' ugly (it's not an existing word and unless you're from a
very specific culture you won't recognize it).  I agree that except
has this flaw, but I don't want to tie solving it to this discussion
(i.e. I don't want to talk about it in *this* thread).

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

Done.

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list