Hi, sorry, I have these ideas for longer than 10 years, please have a look on it and comment on it. Thx.
---- This is another proposal for introducing types into Python. There are many reasons for incorporating types into Python, but there is also a lot of concern about doing so because of destroying the original character of Python as a smart script language. This proposal adds several advantages of Prolog(ue) techniques without changing the natural understanding of Python as a language. Proposal: 1. Method definitions can be non-unique if a type is prefixed to one or more of its parameters, or the parameters differ in number. 2. A keyword 'reject' is added. 3. A keyword 'fail' is added. 4. A keyword 'cut' is added. Definition: 1. A "type" is a String naming the actual class or class family which the passed instanced is derived from, prefixing the parameter. 2. "'reject'" is a marker inside a function/method and signals that further processing will not be done inside this method, but instead be passed to the next available function/method in row, otherwise an implicit "fail" will occur. 3. "'fail'" is a marker inside a function/method and signals that NO further processing can be done in neither of this or the following functions/methods. 4. "'cut'" is a marker inside a function/method that signals that the failure of called functions/methods inside of it, following this statement, automatically lead to a failure, instead of trying the next method - normally, it would be "reject" instead. 5. Failure of functions/methods to outside of this new context are signalled with a new exception e.g. "MethodRetrialError". E.g. def whoisthethief("List" x): return iknowit(x) def whoisthethief("String" x, "String" y): return iknowit([x,y]) ########## def numeral_add(a, b): if type(a)!=types.IntType: reject ... # equivalent to: def numeral_add("Integer" a, b): ... -- http://mail.python.org/mailman/listinfo/python-list