[Types-sig] typecase hack
scott
scott@chronis.pobox.com
Sun, 23 Jan 2000 11:26:08 -0500
Interesting. Yes, it should work. Are you proposing this as the way
to do it? It'd be nice if it works, but my vote has gotta side with
the availability of a more elegant approach. I think this
disambiguating thing is going to happen a lot, mostly as the result of
things defaulting to None so often. I count 147 (is (not)?|==)\s*None
matches in the standard library.
Neat, though.
scott
On Sat, Jan 22, 2000 at 10:41:16AM -0500, Guido van Rossum wrote:
> Just asked me to explain the need for typecase again, and I realized
> that there's a parallel with except clauses. With only a little bit
> of imagination we could make the official way to spell a typecase as
> follows:
>
> try: raise x
> except int, xi: ...use xi: int...
> except str, xs: ...use xs: str...
>
> I'm not saying this is particularly elegant -- but it should work,
> once types and classes are more similar.
>
> --Guido van Rossum (home page: http://www.python.org/~guido/)
>
> _______________________________________________
> Types-SIG mailing list
> Types-SIG@python.org
> http://www.python.org/mailman/listinfo/types-sig