使用大括号而不是缩进,再加上python语法中添加的糖。
brackets的Python项目详细描述
括号是另一种,不仅仅是预处理器,是一种语言 在python之上,允许使用{}而不是python中的缩进, 它允许定义强大的匿名函数并引入 在python的语法和能力中加入更多的糖和糖果。
访问Brackets Website获取示例和 更多信息或read the docs。 项目托管于 github。
一些示例:
// Use braces in Python! def fib(n) { a, b = 0, 1 while (a < n) { print(a, end=' ') a, b = b, a+b } print() } /* Powerful anonymous functions */ print([def(x) { if(x in [0, 1]) { return x }; while (x < 100) { x = x ** 2 }; return x }(x) for x in range(0, 10)])
访问Brackets Website获取示例和 更多信息或read the docs了解 如何使用。