def fib():
a, b = 0L, 1L #The 'L's make the numbers 64-bitwhile true:
yield b
a, b = b, a + b
# Print the first 5 numbers in the series:for index as int, element inzip(range(5), fib()):
print("${index+1}: ${element}")
Basic Windows Form example demonstrating classes, closures, and events
import System.Windows.Formsfrom System.Windows.Formsimport System.Drawingclass MyForm(Form):
def constructor(message as string):
b = Button(Text: "Click Me")
b.Location = Point(100, 50)
b.Click += do():
MessageBox.Show(message)self.Controls.Add(b)
f = MyForm("you clicked the button!")
Application.Run(f)
Asynchronous design pattern with an anonymous function
import System
def run():
print("executing")print"started"
result = run.BeginInvoke({print("called back")})
System.Threading.Thread.Sleep(50ms)
run.EndInvoke(result)print"done"
IronPython - an implementation of Python for the .NET platform, similar to Jython.
Nemerle - a high-level statically-typed programming language for the .NET platform. It offers functional, object-oriented and imperative features as well as macros.
Groovy - a language with similar objectives but targeting the Java Platform
REBOL - a more mature language sharing common goals.