PEP 318 (wrappers), multimethods, strict typechecking (was Re: OT(Slightly): Thanks to Python.

Ville Vainio ville at spammers.com
Sat Mar 13 04:17:13 EST 2004


    Ville> Or in Python 2.4 (strict_type is hypothetical for now):

    Ville> def foo(a,b) [typecheck(type1, type2):
    Ville> pass

    Ville> def foo(a,b) [typecheck(type3, type4):
    Ville> pass

    Ville> which is even nicer :-).

Damn, my brain never works properly on sat/sun morning. Obviously I
meant that there could be wrappers for:

asserttype: check all args w/ isinstance

multimethod: dynamically choose the func/method to execute. Slow, but
sometimes people need it.

And if someone wonders what I'm going on about, check out:

http://www.python.org/peps/pep-0318.html

This might also be a good time to dream up all kinds of cool wrappers
we can think about :)

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list