目录
Mojo as a member of the Python familyMojo 作为 Python 家族的一员
How compatible is Mojo with Python really?Mojo与Python的兼容性如何?
Intentional differences from Python有意与 Python 的差异
What’s wrong with Python?Python有什么问题?
Related work: other approaches to improve Python相关工作:改进 Python 的其他方法
The __copyinit__ 和 __moveinit__ 特殊方法
print("Hello Mojo!")
def your_function(a, b):
let c = a
# Uncomment to see an error:
# c = b # error: c is immutable
if c != b:
let d = b
print(d)
your_function(2, 3)
def your_function():
let x: Int = 42
let y: F64 = 17.0
let z: F32
if x != 0:
z = 1.0
else:
z = foo()
print(z)
def foo() -> F32:
return 3.14
your_function()
struct MyPair:
var first: Int
var second: Int
# We