DenkzeitWiki

Suchen:

Aktuelle Änderungen Printable View Änderungen Bearbeiten

PyChart > PyDev > Eclipse > PyGames > PyQuotes > PyWin > PythonWindowsProgramming > PyWin32 > PythonWindowsProgramming > Python > PythonSprache > PythonDoctest > PythonEggs > PythonEvangelism > PythonExecutables > PythonExif > PythonFunctionAnnotationsClear Trail
Main /

Python Function Annotations

Python

OptionalStaticTyping

def haul(item: Haulable, *vargs: PackAnimal) -> Distance:
    ...

Use Cases

for simple type-based dispatch, an inline way of specifying type or interface would be quite nice for generic functions.[1]

 
 @overload(int, str)
 def foo(bar, baz):
     ...

 @overload
 def foo(bar: int, baz: str)
     ...
 

In other words, what I'm saying is that declarations could be a purely syntactic/metadata feature, and they'd still be quite useful for many things.

  • the annotations must be introspectable (i.e. accessible in code, from outside the function)

Type Declaration


Discussion


Edit - BackLinks - Tags - Page Hist - Print - Changes - Home - Orphans - Help

Zuletzt geändert am 18.03.2008 22:48 Uhr und seit 7. April 2005 992 aufgerufen.