Guido has proposed a syntax for type annotations in Python-3000.
Example:
def foo(x: t1, y: t2) -> t3:
...body...
http://www.artima.com/weblogs/viewpost.jsp?thread=87182
The types are dynamic and there is significant execution of code prior
to the function body being called. Which tends to
If we -are- limited to lambdas, I see two options. Either embed lambdas
for each circular link, or have the whole expression in one lambda. ie
LinkedList3 = (int, lambda: LinkedList3, lambda: TypeNameX)
vs
LinkedList2 = lambda: (int, LinkedList2, TypeNameX)
The second option looks neate
That's a good fix. But I have misgivngs about needing a global name
registry. I need to support anonymous types and types with local
(lexical) scope. For example:
def makeAnonymousRecursiveType(T):
# anonymous type expression with local scope
LinkedList = (T, lambda: LinkedList)
return
How about mutual recursion?
class LinkedListA(TypeDef):
typedef = (int, LinkedListB)
class LinkedListB(TypeDef):
typedef = (int, LinkedListA)
--
http://mail.python.org/mailman/listinfo/python-list
While working on type expressions I am rather stuck for a
way to express recursive types. A simple example of this is a
singly-linked list of integers. In some languages you have compiler
syntax
which suspends evaluation so you can have recursive types. e.g.
typedef Linked_List := int, Linked_
Hi,
I'm researching the history of proposals to add types to Python, partly
to improve my own code, and secondly to be able to make an informed PEP
one day.
The Types-SIG archives link
(http://mail.python.org/pipermail/types-sig/) gives a 404 error. Does
anyone know how to get the archive back?