"Ian Bicking" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> I don't know if there's an advantage to presenting a signature that > accurately describes the function; it can never *really* be accurate in > all cases, as there can be all sorts of constraints that are impossible > to represent in the signature (like mutually exclusive keyword > arguments). On the contrary ;-), we could add a parameter operator !^!, used as def f(*prohibited, a=None !^! b=None): blah to make the keywords exclusive and automatically raise an exception if both are given values, or perhaps if both are given values other than, in this case, None. But do we really want to substitute signature syntax for body code to do this? > But then by putting in *args to constrain arguments to > keywords, you formally represent the keyword constraint while adding a > very inaccurate representation of the function signature for positional > arguments. But I intentionally did not use '*args' but instead used '*ignored' in my example and also suggest '*prohibited' as a convention. Either should be clear enough to a code reader if used as consistently as 'self'. Doc strings should just say 'positional args prohibited'. Introspection code that generates alternate signature representations from func and code attributes could be made convention aware. Terry Jan Reedy _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com