On 4/10/06, Chaz. <[EMAIL PROTECTED]> wrote:
> If you are going this far, why not also support a throws() modifier (or
> whatever you might call it).
>
> Right now I do something like:
>
> @throws(IOError)
> def foo(...) :
>
> as a way to indicate that foo() can throw a specific exception.
>
> I might suggest
>
> def foo(...) throws(...) :
>
> as a more integrated approach.

-1 without more (and I mean A LOT MORE) motivation. IOW unless you
write a whole PEP I'm going to ignore this proposal.

> On this direct topic because there is no type-specific polymorphism in
> Python,

What does that mean? I always think of Python as a language with
excellent support for polymorphism (due to duck typing). So you
probably are using words in a way that I don't understand (don't
worry, that happens all the time).

> I occasionally write functions that do slightly different things
> depending on the type of input. Is there an approach to say a specific
> argument can take any number of different types?

Yes, I proposed using the '|' operator to separate alternatives. E.g.

def foo(x: int|float, y: str|list[str]): ...

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to