Pyke可以做点什么吃?

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

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:

  • Adaptability/Customization
    • Using Pyke allows your Python code to be combined into thousands of different configurations.
    • Thus, your application or library takes on the characteristics of a Domain Specific Language to achieve an order of magnitude increase in adaptability without a corresponding increase in your program's "surface area" to your users.
  • Performance
    • Thinking of your application or library as a Domain Specific Language (DSL), you're using Pyke to "compile" rather than "interpret" your DSL to achieve an order of magnitude improvement in performance.
  • Code Reuse
    • Making your code an order of magnitude more adaptable and an order of magnitude faster allows it to be (re)used in a correspondingly broader range of situations.

烹制Python代码实质是“元编程”的一种形式,或是写段程序来处理其它程序。例如,去看看什么是programming in the large 和programming in th small……
因此Pyke提供了直接“program in the large"的方法,与用Python来“program in the small"的思想是吻合的。Pyke是对Python的补充,而不是想去替代它。
Pyke帮助程序员完成了以下的改进:
  • 适应性/用户化   
                       使用Pyke可以Python代码合并进大量的不同配置中;
                        因此你的程序或者库应具有一个域特定语言(DSL)的特性来在适应性上得到快速增强,而不是使你的用户看起来它 们 在增强。
  • 性能
                       把你的程序和库想象成DSL,使用Pyke“编译”而不是“解释”你的DSL来取得性能上的大量改进。

  • 代码重用
                       使你的代码更具适应性,更有效率,保证在相当大范围的情况下可以重用。


Examples of Cooking Python Code

Database Access Library

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的例子证明了这点。

 

 

HTML Templating Library

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:

  • TurboGears 2 ran 75.83 transactions/sec
  • The Pyke example ran 791.01 transactions/sec

HTML模板库

你在编写一个html模板包使Python程序员生成html更容易。用Python写下处理html的代码,然后用Pyke为每个heml模板制作一个成熟的代码版本。
采用这种方法,你的库将比别的html模板库更快因为你使用了Pyke对每个html模板都进行编译。
web_framework例子论证了这点。它使用sqlgen做了一个小的web框架。在这个例子中这两个html模板也在TurboGears2完成并进行了siege基准测试:
  • TurboGears2        75.83个事务
  • Pyke例子               791.01事务
差的多了点把……

Linux Configuration Program

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配置程序

你在写一个新的linux配置程序,用Python来查询和设置各种系统配置属性,然后用Pyke询问用户需要什么,建立一个成熟版本。

这种情况下,不用关注性能。使用Pyke

你可能感兴趣的:(html,linux,python,Access,performance)