Pyke was primarily designed to allow you to "cook" your Python code. You write Python code, and then you write Pyke code to cook that Python code -- i.e. to assemble the Python functions that you've written and customize them for a specific situation or use-case.
Pyke can also be used for difficult decision making applications where each part of the problem has multiple possible solutions and the selection of a solution to one part of the problem affects whether another part of the problem can be solved or not. Examples of these kind of applications are listed on the home page .
Pyke用来“烹调”(“cook“)你的Python代码。写下Python代码后,可以使用Pyke来“烹制”下——就是说编辑你的Python函数并且为了专门的场合和使用情况设置它们。
Pyke也可以用在编写应用时的困难取择:问题的每个部分都有多种解决方法,这些解决方法还有可能影响到问题的其它部分。
您中间倒是断个句啊……
Cooking your Python code is a form of meta-programming, or writing programs that manipulate other programs. I.e., it's a means of programming in the large .
Thus, Pyke provides a way to directly "program in the large", which dovetails with using Python to "program in the small". Pyke supplements but does not replace Python!
Pyke helps programmers to achieve order of magnitude improvements in:
You're writing a library package to make it easier for Python programmers to access relational databases. You write Python code that deals with the mechanics of accessing relational databases, and then you write Pyke code to make a cooked version of this code for each database access with your user's application.
You might also use Pyke to provide help installing and configuring the database and help creating the schema.
By taking this approach, your library will be an order of magnitude faster than competing database access libraries because you've used Pyke to essentially compile custom code for each database access.
The sqlgen example demonstrates this approach.
你写了一个库包使得Python程序可以容易地读取对应的数据库。你用Python写了存取相应数据库方法的代码,然后编写Pyke代码制造了每个数据库存取过程的代码成熟版本。
你可能也用Pyke提供安装和配置数据库和创建模式的帮助。采取这种方式,你编写的库包会比其它库包快很多因为你使用了Pyke对每个数据库存取过程进行了根本的编译。
sqlgen的例子证明了这点。
Or you're writing an HTML templating package to make it easier for Python programmers to generate HTML. You write Python code that deals with the mechanics of HTML, and then you write Pyke code to make a cooked version of this code for each HTML template.
By taking this approach, your library will be an order of magnitude faster than competing HTML templating libraries because you've used Pyke to essentially compile custom code for each HTML template.
The web_framework example demonstrates this approach. It uses the sqlgen example to make a little web framework. The 2 HTML templates in this example were also done in TurboGears 2 and then a siege benchmark test done on both:
Or you're writing a new Linux configuration program. You write the Python code to query and set the various system configuration options, and then you write Pyke code to ask the user what he wants and build a cooked version of your code to make the necessary changes.
In this case, you're not looking for performance. You use Pyke to handle the complicated decision making and use its plan facility to postpone making any configuration changes until your program is sure that it's "dotted all of the i's and crossed all the t's".
你在写一个新的linux配置程序,用Python来查询和设置各种系统配置属性,然后用Pyke询问用户需要什么,建立一个成熟版本。
这种情况下,不用关注性能。使用Pyke