`
angeloce
  • 浏览: 71106 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Pyke可以做点什么吃?

    博客分类:
  • 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

分享到:
评论

相关推荐

    开源规则引擎Pyke研究报告

    开源规则引擎pyke的研究报告,大多数为对手册的理解、翻译

    pyke专家系统

    pyke包了python2与python3的源码。这个是专家系统的一个包。

    pyke‑1.1.1‑py2‑none‑any.whl

    离线安装包,测试可用。使用 pip install [完整包名] 进行安装

    pyke:PyKE-Python知识引擎(http

    Pyke:Python知识引擎 这是原始的镜像,可用作参考以及PyPI包的创建和维护。 一切归功于原始作者( 。 此存储库中的代码仅基于PyKE的Python 3版本,因为2020年不推荐使用Python2。因此,可能会删除与Python 2相关的...

    Python Knowledge Engine (PyKE)-开源

    正向和反向链接规则(可能包括python代码)都被编译为python。 还可以从附加到反向链接规则的python函数中自动组装python程序。 参见pyke.sourceforge.ne

    规则引擎-规则包导出

    在我们编写好的规则包之后,可以将规则包的rpk文件导出到指定的路径,也可以将规则包逻辑部分导出到指定的excel中,也可以导出规则包相应的java代码。这样规则包的就可以以不同方式保存下来,方便业务人员,开发人员...

    python规则引擎对比报告

    对pyke和pyclips引擎在功能特点、语法结构和性能表现上,做粗浅的对比。入门级、自制文档

    Python库 | pykep-2.1-cp35-cp35m-win_amd64.whl

    python库。资源全名:pykep-2.1-cp35-cp35m-win_amd64.whl

    PyPI 官网下载 | pykechain-3.8.2-py2.py3-none-any.whl

    资源来自pypi官网。 资源全名:pykechain-3.8.2-py2.py3-none-any.whl

    使用 Drools 规则引擎实现业务逻辑

    使用规则引擎可以通过降低实现复杂业务逻辑的组件的复杂性,降低应用程序的维护和可扩展性成本。这篇更新的文章展示如何使用开源的 Drools 规则引擎让 Java™ 应用程序更适应变化。Drools 项目引入了一个新的本地...

    Expert System Of Intellectual Operations:智能操作专家系统-开源

    (西班牙语)就像我们相加例如 1 + 2 + 3,首先我们相加 1 + 2 = 3,然后我们相加 3 + 3 = 6,有了这些信息我们也可以进行运算。 通过这种方式,我们可以获得先验信息,并在对其应用智能算子后,它会为我们提供后续...

    Rule-Based-Engine-pyknow:基于Python规则引擎的决策支持系统项目-pyknow

    安装及使用要在shell pip install pyknow安装此python软件包simpy typ, pip install pyknow不是在您的代码类型中使用该软件包回购里面有什么如何设定首先下载要在您的CLI中运行回购协议的文件git clone ...

    tcpsplice:高带宽的高延迟TCP连接

    去做 监控方式 打包 (需要devscripts包) 您可以选择通过在shell提示符下键入以下命令来构建Debian软件包: $ make deb 该tcpsplice二进制将被封装在被安装/usr/sbin目录中,额外的启动脚本,并在默认的配置文件/...

    Legendary Guides-crx插件

    (为什么任何站点都需要特定的大小写才能正常运行url,这超出了我的范围。)Update 3.0:重大更新。 -右键单击冠军将其收藏! -现在,您可以自定义点击+键打开的网站。 -点击应用中的帮助以获取帮助。 -添加了Neeko...

    sffmpeg:功能齐全的静态FFmpeg构建助手

    目前,它可以在Linux和其他POSIX系统上工作(有一些调整)。 它已在Linux / x86_64(Ubuntu 18.04)上进行了最严格的测试。 该帮助程序将获取大多数FFmpeg依赖项的最新版本,从而提供一种在同一主机上有效构建,...

    传奇指南「Legendary Guides」-crx插件

    (为什么任何站点都需要特定的大小写才能正常运行url,这超出了我的范围。)Update 3.0:重大更新。 -右键单击冠军将其收藏! -现在,您可以自定义点击+键打开的网站。 -点击应用中的帮助以获取帮助。 -添加了Neeko...

Global site tag (gtag.js) - Google Analytics