On 5/19/06, Collin Winter <[EMAIL PROTECTED]> wrote:
> Let's go back to Function(<type>, <type>, ..., returns=<type>)

I just finished converting typecheck's test suite to use this
notation, and I have the following to report: ick.

The main problem is when the function returns a complex type:

>>> Function(int, int, returns=(int, int))
or:
>>> Function(returns=(int, int))

I find the latter even worse than the former.

I played around, switching it back and forth between the above and

>>> Function(int, int).returns(int, int)
and
>>> Function().returns(int, int)

Using the methods, though, does mean you might end up with something
like this when it comes to changing the Function()'s strictness:

>>> Function(int, int, int).returns(int, int).is_strict(True)

However, you can change the strictness settings for all Function()s
using the class-level Function.default_strict attribute; I imagine
most people wanting to change strictness will do so via the class, not
the individual instances. I expect the majority of usages to look
like:

>>> Function(<type>, <type>, <type>).returns(<type>, <type>)

...with which I am pleased muchly.

Collin Winter
_______________________________________________
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