Python本身实现了另一种脚本语言? [英] Another scripting language implemented into Python itself?

查看:67
本文介绍了Python本身实现了另一种脚本语言?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣开发一个应用程序,其中用户有足够的电量来定制应用程序以满足他们的需求,并且

我觉得这最好是如果脚本语言可用,则可以完成。但是,我想用Python编写这个应用程序,而且我还没有听说过在Python中使用另一种脚本语言

的实现。

我的意思是这个(Lua到Ruby的实现

- 我不想使用它): http://ruby-lua.unolotiene.com/


我知道C / C ++可能更适合这种任务,但是我的应用程序中需要速度的模块中的大多数已经用C ++编码了
。我想用Python作为胶水。对于这个项目;

使用漂亮的GUI编写整个应用程序并不好玩,因为大多数

你可能从以前的经验中知道。


所以,我的问题很简单:Python中是否有另一种

脚本语言的实现?

解决方案

< blockquote>在文章< ma *************************************** @ python。 org>,

Quest Master< za ****** @ gmail.com>写道:

我有兴趣开发一个应用程序,用户有足够的力量来定制应用程序以满足他们的需求,
我觉得这个如果有可用的脚本语言,最好能完成。但是,我想用Python编写这个应用程序代码,而且我还没有听说过将另一种脚本语言实现到Python中。

我的意思是这个(将Lua实现为Ruby
- 我不想使用它): http://ruby-lua.unolotiene.com/

我知道C / C ++可能更适合这类任务,但大部分都是
我的应用程序中需要速度的模块已经用C ++编码。我想用Python作为胶水。对于这个项目;用漂亮的GUI编写整个应用程序并不好玩,因为你可能从以前的经验中了解到的大部分内容。

所以,我的问题就是:是否在Python中实现了另一种脚本语言?




Python *是一种脚本语言。为什么不让你的用户写一下?b $ b Python模块你通过一些定义的API导入和执行它们?


Roy Smith写道:

文章< ma ************************************ ***@蟒蛇。 org>,
Quest Master< za ****** @ gmail.com>写道:

所以,我的问题就是这样:Python中是否有另一种脚本语言的实现?



Python *是*脚本语言。为什么不让你的用户编写你通过一些定义的API导入和执行的Python模块?




因为你不能使Python对恶意安全(或者

无知)用户 - 对于用户代码可能损害系统的每种可能方式,能够保护

的灵活性太大。 />
解析你自己的(有限的)脚本语言可以更好地控制用户代码能够做什么,因此允许

(至少对恶意代码的安全措施。


对于OP:是的,人们用Python实现了其他语言。

例如,我相信Danny Yoo用Python写了一个Scheme

口译员(Google告诉我它应该在
http://hkn.eecs.berkeley.edu/~dyoo/python/pyscheme 但我没有得到

来自该主机的响应),但我不知道Scheme

是否算作脚本语言。 ;)


但是,如果您为这些用户使用功能齐全的语言

脚本,您可能会遇到相同的安全问题我提到了

Python。除非你真的需要这种级别的功能,否则你可以更好地设计自己的有限语言。检查文件

for pyparsing for a starter ...


Jeff Shannon

技术员/程序员

Credit International




" Roy Smith" < ro*@panix.com>在消息中写道

news:ro *********************** @ reader1.panix.com ..。

文章< ma *************************************** @ python 。 org>,
Quest Master< za ****** @ gmail.com>写道:

所以,我的问题就是这样:Python中是否有另一种脚本语言的实现?



Python *是*脚本语言。为什么不让你的用户写出你通过一些定义的API导入和执行的Python模块?




这也是我的想法,注意到您只需要将用户需要的文件记录为

,包括要导入的特定模块(如果有的话)。


Terry J. Reedy


I am interested in developing an application where the user has an
ample amount of power to customize the application to their needs, and
I feel this would best be accomplished if a scripting language was
available. However, I want to code this application in Python, and I
have not yet heard of an implementation of another scripting language
into Python.

An example of what I mean is this (an implementation of Lua into Ruby
-- which I''d prefer not to use): http://ruby-lua.unolotiene.com/

I know C/C++ might be better suited for a task of this kind, but most
of the modules in my application which need speed have already been
coded in C++. I want to use Python as the "glue" for this project;
writing an entire application with a pretty GUI is not fun, as most of
you may know from previous experience.

So, my question is simply this: is there an implementation of another
scripting language into Python?

解决方案

In article <ma***************************************@python. org>,
Quest Master <za******@gmail.com> wrote:

I am interested in developing an application where the user has an
ample amount of power to customize the application to their needs, and
I feel this would best be accomplished if a scripting language was
available. However, I want to code this application in Python, and I
have not yet heard of an implementation of another scripting language
into Python.

An example of what I mean is this (an implementation of Lua into Ruby
-- which I''d prefer not to use): http://ruby-lua.unolotiene.com/

I know C/C++ might be better suited for a task of this kind, but most
of the modules in my application which need speed have already been
coded in C++. I want to use Python as the "glue" for this project;
writing an entire application with a pretty GUI is not fun, as most of
you may know from previous experience.

So, my question is simply this: is there an implementation of another
scripting language into Python?



Python *is* a scripting language. Why not just let your users write
Python modules which you them import and execute via some defined API?


Roy Smith wrote:

In article <ma***************************************@python. org>,
Quest Master <za******@gmail.com> wrote:

So, my question is simply this: is there an implementation of another
scripting language into Python?



Python *is* a scripting language. Why not just let your users write
Python modules which you them import and execute via some defined API?



Because you cannot make Python secure against a malicious (or
ignorant) user -- there''s too much flexibility to be able to guard
against every possible way in which user-code could harm the system.
Parsing your own (limited) scripting language allows much better
control over what user-code is capable of doing, and therefore allows
(at least some measure of) security against malicious code.

To the O.P.: Yes, people have implemented other languages in Python.
For example, I believe that Danny Yoo has written a Scheme
interpreter in Python (Google tells me it should be at
http://hkn.eecs.berkeley.edu/~dyoo/python/pyscheme but I''m getting no
response from that host right now), but I don''t know whether Scheme
counts as a scripting language. ;)

However, if you''re using a fully-featured language for these user
scripts, you''ll probably have the same security issues I mentioned for
Python. Unless you really need that level of features, you may be
better off designing your own limited language. Check into the docs
for pyparsing for a starter...

Jeff Shannon
Technician/Programmer
Credit International



"Roy Smith" <ro*@panix.com> wrote in message
news:ro***********************@reader1.panix.com.. .

In article <ma***************************************@python. org>,
Quest Master <za******@gmail.com> wrote:

So, my question is simply this: is there an implementation of another
scripting language into Python?



Python *is* a scripting language. Why not just let your users write
Python modules which you them import and execute via some defined API?



That was my thought also, with the note that you only need to document as
much users will need, including specific modules (if any) to import.

Terry J. Reedy


这篇关于Python本身实现了另一种脚本语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆