为我的特定利基选择Perl / Python [英] Choosing Perl/Python for my particular niche

查看:53
本文介绍了为我的特定利基选择Perl / Python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


这不是一个巨魔发布,我已经避免了

问,因为我看到类似的线程得到所有

nitter-nattery。但我真的想就如何最好地投入时间做出决定

。我对

不感兴趣哪种语言在* general *中更好,只是为了我的

目的。我的研究领域是CAD算法,

我感觉需要采用比C ++,bash脚本或sed脚本更方便的东西。 br />
我希望做的是多方面的。我不想讨论的是网络应用程序(虽然我不确定

的相似之处)。没有XML处理或数据库

在我的工作中互动。


我希望做的一件事是修改设计

文件。例如,有一个工具采用ASCII

硬件解码语言(HDL)并将其转换为C ++(由硬件模拟库增加)。

翻译是免费软件,因此我需要通过调整HDL代码来弥补限制。在

过去,我已经为这些任务找到了sed脚本,但

会欣赏更传统的语言。由于Per / b $ b perl在数字IC设计中使用很多,因此我只需要转换我的

邮件就可以获得刺激
别名从一个邮件阅读器到另一个邮件阅读器。它需要一段时间才能完成,而且我很担心

等级的难度。如果我经常做这种事情,我可能会很精通并且使用它背后的力量

它,但它不是我的主要区域。


替代方案是Python,它更容易阅读

来自我读过的内容。我担心的是,我自己从大量可用的东西中扣除了b
$ b。例如,我使用一个名为VNC的PC-to-solaris

查看器,我已经撞击了

启动脚本,为我改变了一下情况。

同样,上面的翻译人员在操作中广泛使用Perl

,以及它的构建和

安装。如果我不熟悉的话,我会更难以安装

它。在大约区域的数字电路中,

我关心的是在乐队旅行车上,如果只是为了b / b
以避免重新发明事物,或者阻碍共享

件。


另一个使用场景是(如果合理)

替换我的shell脚本例如我刚刚从tcsh转换为

bash来编写脚本,通过一系列过滤器来推送文件

,或者只是作为包装器

周围一个难以使用的实用程序,例如pstops。最后的

示例是获取一份设计信息文件,而b / b $ b比调整它更多,例如提取有关电路构建块之间互连的所有信息



包括哪个是源块,以及

目标块。通常,这些信息将由matlab脚本读取并传递给我的C ++代码

(我已设法避免编写代码来解析
$来自C ++的b $ b输入文件。


无论我走哪条路,我都希望避免学习Perl和Python的开销。我将以一种吝啬的方式刻出一些

的时间来慢慢了解一个。由于

我花了大部分时间在Matlab中探索算法,或者用
C ++ / STL,所以只有这么多时间才能获得更高的水平

语言(在我淘汰时间之前花了几年时间

从tcsh切换到bash)。

使得决定不明确的一个原因是,尽管Python的

声称更温和的学习曲线和更清晰的代码,我

通常喜欢sed的权宜之计,例如一个简洁的单行

,可以使用其他shell命令进行流水线操作。我还要注意,Perl'的不健康只适用于大型的b
项目,而且我不希望使用Perl那个

方式。


我已经看到了提到鹦鹉和perl6,这是一个非常好的方式。我不确定我的决定应该多少,因为它还不是真的。


感谢您的任何意见/建议。

-

Fred Ma

卡尔顿大学电子学系

1125上校By Drive,渥太华,安大略省

加拿大,K1S 5B6

解决方案

只想添加另一个例子

我遇到了很多。与许多计算机语言一样,

各种范围由事物描述

如大括号或开始/结束语句。我经常发现

在某些

范围结构中发现某些事物的价值很有价值。

(例如某些数据声明)。 Sed很方便:


/ SomeStartPattern /,/ SomeEndPattern / {

做一些东西,

包括条件分支< br $>
}


为了避免编写脚本文件的麻烦和

将输入源文件过滤到输出源

文件,我经常使用gvim'的超棒模式匹配

和宏录制功能。一个sed脚本文件

看起来很神秘,特别是当我想要

来搜索物理行时(很多条件

流来追加东西保持缓冲区等。)。

因为这个原因,我倾向于坚持使用gvim中的快速/脏的

做法。 Crypticness(虽然不是

相同的品种)是我发现的事情之一

很难在Perl上升,达到
$ b的程度$ b我做到了。正如我之前所暗示的那样,如果我变得像Guru一样,那么公平的比较就会显示出它的力量会更加明显。但是

实际上,我不会花费足够的时间来定期支付它。在这里再次

是二分法;我很欣赏sed的简洁性,因为

我可以在其中创建一个命令行管道阶段,但

脚本语言的简洁可以为

粗暴。也许这是一厢情愿的想要

一种语言来涵盖我最初提到的所有基础

提到的。


弗雷德

-

Fred Ma

卡尔顿大学电子学系

1125上校By Drive,渥太华,安大略省

加拿大,K1S 5B6


还有弗雷德马::

这不是巨魔张贴,我已经避免了询问,因为我看到类似的线程得到了所有的痛苦。但我真的想做出如何最好地投入时间的决定。我不感兴趣
哪种语言在* general *中更好,仅仅是为了我的目的。我的研究领域是CAD算法,我觉得有必要采用比C ++,bash脚本或sed脚本更方便的东西。
我希望做什么有点多方面。我不想涉足的是网络应用程序(虽然我不确定
的相似之处)。我所做的事情中没有XML处理或数据库交互。


谁知道呢。做某些事情的愿望随着技能的增长而增长。

我希望做的一件事就是修改设计文件。例如,有一个工具采用ASCII
硬件描述语言(HDL)并将其转换为C ++(由硬件模拟库增加)。
翻译是免费软件,因此有局限性我必须通过调整HDL代码来弥补这一点。在过去,我已经为这些任务找到了sed脚本,但
会更喜欢更传统的语言。由于Perl在数字IC设计中有很多用途,因此我只需要将一个邮件阅读器从一个邮件阅读器转换到另一个邮件别名的简单需要,我就这样做了。它需要一段时间才能做到,而且我很关心
级别的难度。如果我经常做这种事情,我可能会精通并使用它背后的力量,但这不是我的主要领域。


这听起来像是一个文本处理任务。 Perl在这方面的优势

是众所周知的,因此没有必要深入研究。大多数

脚本语言(包括Python)都可以在这里使用。

替代方案是Python,它更易于阅读
读。我担心的是,我将自己从大量可用的东西中解脱出来。例如,我使用一个名为VNC的PC-to-solaris
查看器,我已经对着
启动脚本猛烈抨击,以便根据我的情况稍微改变一下。
同样,上述翻译人员在操作中广泛使用Perl,以及它的构建和安装。如果我不熟悉Perl,我会更难安装
它。在大概的区域数字电路,
我关心的是在乐队旅行车,如果只是为了避免重新发明事物,或阻碍分享事物。


这是使用Perl的强有力理由。虽然它可能并不总是希望能够让这条线路受到影响,但现在却是这样。从长远来看,可以轻松地将工具的可用性集成到自己的工作中将为您节省大量的工作。我不知道Perl在IC设计领域特别强大。
。如果是这样,那就好了。


除了这个特殊情况,当存在可以使用的预编码代码时,通常是一件好事。 。这个代码用于
Perl是非常庞大的(几千个库)并且聚集在一个

的地方(CPAN),它有一个统一的界面来访问和安装它们

a围绕它建立了庞大的基础设施。


我不知道Python的具体情况是多少或者是否已经具有

近期显着改善。前一段时间至少那里没有这样的事情。

另一个使用场景是(如果合理的话)
替换我的shell脚本,例如我刚刚从tcsh转换为
bash来编写通过一系列过滤器推送文档的脚本,或简单地作为一个包装器围绕一个难以使用的实用程序,例如pstops。最后一个例子是获取一个设计信息文件,而不仅仅是调整它,例如提取所有关于电路构建块之间互连的信息,包括哪个源块,以及哪些是目标块。通常,这些信息将由matlab脚本读取并传递给我的C ++代码
(我已经设法避免编写代码来解析来自C ++的
输入文件)。


与文本处理一样,Python和Perl都提供了所需的所有必需的物品。粗略地看一下,它们的得分是平分的。

无论我走哪条路,我都希望避免学习Perl和Python的开销。我将以一种吝啬的方式刻画一些时间,慢慢地了解一个。由于我花了大部分时间在Matlab或者C ++ / STL中探索算法,所以只需要很多时间来学习更高级别的语言(在我炮击之前需要花费数年时间)从tcsh切换到bash的时间。
让决定不明确的一个原因是,尽管Python声称它具有更温和的学习曲线和更清晰的代码,但我常常喜欢sed的权宜之计,例如:一个简洁的单行内容,可以与其他shell命令进行流水线操作。我还注意到,Perl的不合适只适用于大型项目,而且我不希望使用Perl那么多。
方式。


Perl在涉及单行并且可能替换shell脚本时获胜。

因为我倾向于容易忘记bash脚本语言的语法,我已经完全用Perl取代了它。$ / b

Perl在大型项目上的不良声誉可能是由于差异造成的。
使用Perl的那些人的
。一个大型团队是系统管理员,他们以完全不同的方式使用Perl

,与构建更大的

系统的人相比。然而,有足够的非常大的Perl项目显示

它可以轻松地使用它(至少只要一个

让sys-admin远离来自消息来源;-)。

我已经看到过提到鹦鹉和perl6,这是相当不错的。我不确定应该对我的决定有多重要,因为它还不是真的。




它不应该。 Perl6大部分是大型

项目健身的又一次飞跃。我不认为它会为那些更糟糕的任务获得更多收益。

此外,没有人知道Perl6何时到期。


Tassilo

-


_ = q#",}])!JAPH!qq(tsuJ [{@" tnirp} 3 .. 0} _

Hello,

This is not a troll posting, and I''ve refrained from
asking because I''ve seen similar threads get all
nitter-nattery. But I really want to make a decision
on how best to invest my time. I''m not interested on
which language is better in *general*, just for my
purpose. My area of research is in CAD algorithms,
and I''m sensing the need to resort to something more
expedient than C++, bash scripting, or sed scripting.
What I hope to do is a bit multifaceted. What I don''t
do dabble in is web apps (though I''m not sure of the
similarities). No XML processing or database
interaction in what I do.

One thing I expect to have to do is to modify design
files. For example, there is a tool which takes ASCII
hardware desscription language (HDL) and converts it
to a C++ (augmented by hardware simulation library).
The translator is freeware, so has limitations which I
have to make up for by tweaking the HDL code. In the
past, I''ve eeked out sed scripts for such tasks, but
would appreciate a more traditional language. Since
Perl is used alot in digital IC design, I took a stab
at that, motivated by the simple need to convert my
mail aliases from one mail reader to the other. It
took a while to do, and I''m concerned at the difficulty
level. If I did this kind of thing constantly, I
would probably get proficient and use the power behind
it, but it''s not my main area.

The alternative is Python, which is easier to read
from what I''ve read. My concern there is that I cut
myself off from large availability of stuff that''s
out there. For example, I use a PC-to-solaris
viewer called VNC, and I''ve banged my head against the
startup script to change it a bit for my situation.
Likewise, the above translator uses Perl extensively
in its operation, as well as it''s building and
installation. If I wasn''t passingly familiar with
Perl, I would have had a much harder time installing
it. Being in the approximate area digit circuits,
I''m concerned about being on the band wagon, if only
to avoid reinventing things, or impediments to sharing
things.

An additional usage scenario is to (if reasonable)
replace my shell scripting e.g. I just converted to
bash from tcsh to write scripts that push a document
through a series of filters, or simply as a wrapper
around a tough-to-use utility e.g. pstops. A final
example is to take a file of design information and
do more than tweak it e.g. extract all the information
about interconnections between circuit building blocks,
including which is the source block, and which are the
destination blocks. Typically, this information will
be read by matlab scripts and passed to my C++ code
(I''ve managed to avoid writing code to parse the
input file from C++).

Whichever way I go, I would like to avoid the overhead
of learning both Perl and Python. I will sculpt out some
time in a miserly fashion to slowly get to know one. Since
I spend most of my time exploring the algorithm in Matlab or
C++/STL, there''s only so much time to pick up higher level
languages (it took years before I shelled out the time
to switch from tcsh to bash). One of the things that
makes the decision not clear is that despite Python''s
claim to a gentler learning curve and clearer code, I
often like the expedience of sed e.g. a terse one-liner
that can be pipelined with other shell commands. I
also note that Perl''s unweldiness only comes for big
projects, and I don''t expect to using Perl quite that
way.

I''ve seen mention of parrot and perl6, which is quite a
ways off. I''m not sure how much that should weigh into
my decision, since it isn''t real yet.

Thanks for any comments/suggestions.
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6

解决方案

Just wanted to add another example of stuff that
I encounter alot of. As in many computer languages,
various kinds of scopes are delineated by things
like braces or begin/end statements. I often find
it valuable to find an occurance of certain things
(e.g. certain data declaration) within certain
scope structures. Sed is convenient for that:

/SomeStartPattern/,/SomeEndPattern/{
Do some stuff,
including conditional branching
}

To avoid the hassle of writing a script file and
filtering the input source file to an output source
file, I often use gvim''s awesome pattern matching
and macro recording abilities. A sed script file
can look pretty cryptic, especially when I want
to search across physical lines (lots of conditional
flow to append things to the hold buffer, etc..).
For that reason, I tend to stay with quick/dirty
practices in gvim. Crypticness (though not of the
same variety) is one of the things that I found
hard about ramping up on Perl, to the degree that
I did. As I hinted earlier, a fair comparison would
account for the fact that its power would be more
apparent if I became adequately guru-like, but
realistically, I will not spend enough time with
it on a regular basis to expect that. Here again
is a dichotomy; I appreciate the sed terseness because
I can make a command line pipe stage out of it, but
the same brevity in a scripting language can make for
rough going. Maybe it''s wishful thinking to expect
one language to cover all the bases that I initially
mentioned.

Fred
--
Fred Ma
Dept. of Electronics, Carleton University
1125 Colonel By Drive, Ottawa, Ontario
Canada, K1S 5B6


Also sprach Fred Ma:

This is not a troll posting, and I''ve refrained from
asking because I''ve seen similar threads get all
nitter-nattery. But I really want to make a decision
on how best to invest my time. I''m not interested on
which language is better in *general*, just for my
purpose. My area of research is in CAD algorithms,
and I''m sensing the need to resort to something more
expedient than C++, bash scripting, or sed scripting.
What I hope to do is a bit multifaceted. What I don''t
do dabble in is web apps (though I''m not sure of the
similarities). No XML processing or database
interaction in what I do.
Who knows, though. The desire to do certain things grows with the skills
one acquired.
One thing I expect to have to do is to modify design
files. For example, there is a tool which takes ASCII
hardware desscription language (HDL) and converts it
to a C++ (augmented by hardware simulation library).
The translator is freeware, so has limitations which I
have to make up for by tweaking the HDL code. In the
past, I''ve eeked out sed scripts for such tasks, but
would appreciate a more traditional language. Since
Perl is used alot in digital IC design, I took a stab
at that, motivated by the simple need to convert my
mail aliases from one mail reader to the other. It
took a while to do, and I''m concerned at the difficulty
level. If I did this kind of thing constantly, I
would probably get proficient and use the power behind
it, but it''s not my main area.
That sounds like a text-processing task. Perl''s strengths in this area
are well-known, so there''s no need to go into that deeper. Most
scripting languages (and that includes Python) can be used here.
The alternative is Python, which is easier to read
from what I''ve read. My concern there is that I cut
myself off from large availability of stuff that''s
out there. For example, I use a PC-to-solaris
viewer called VNC, and I''ve banged my head against the
startup script to change it a bit for my situation.
Likewise, the above translator uses Perl extensively
in its operation, as well as it''s building and
installation. If I wasn''t passingly familiar with
Perl, I would have had a much harder time installing
it. Being in the approximate area digit circuits,
I''m concerned about being on the band wagon, if only
to avoid reinventing things, or impediments to sharing
things.
This is a strong reason to use Perl. While it may not always be
desirable to toe the line, here it is. The availability of tools that
can easily be integrated into one''s own work will save you a lot of
work on the long run. I didn''t know that Perl was particularly strong
in the field of IC design. If so, good then.

Apart from this particular case, it''s generally a good thing when
pre-written code exists that can be used. The amount of such code for
Perl is immense (several thousand libraries) and gathered all in one
place (the CPAN) with a unified interface to access and install them and
a vast infrastructure built around it.

I don''t know how much or whether at all the situation for Python has
significantly improved over the recent past. A while ago at least there
was no such thing.
An additional usage scenario is to (if reasonable)
replace my shell scripting e.g. I just converted to
bash from tcsh to write scripts that push a document
through a series of filters, or simply as a wrapper
around a tough-to-use utility e.g. pstops. A final
example is to take a file of design information and
do more than tweak it e.g. extract all the information
about interconnections between circuit building blocks,
including which is the source block, and which are the
destination blocks. Typically, this information will
be read by matlab scripts and passed to my C++ code
(I''ve managed to avoid writing code to parse the
input file from C++).
As with text processing, both Python and Perl offer all the essential
things needed for that. On a cursory glance, the score of them is tied.
Whichever way I go, I would like to avoid the overhead
of learning both Perl and Python. I will sculpt out some
time in a miserly fashion to slowly get to know one. Since
I spend most of my time exploring the algorithm in Matlab or
C++/STL, there''s only so much time to pick up higher level
languages (it took years before I shelled out the time
to switch from tcsh to bash). One of the things that
makes the decision not clear is that despite Python''s
claim to a gentler learning curve and clearer code, I
often like the expedience of sed e.g. a terse one-liner
that can be pipelined with other shell commands. I
also note that Perl''s unweldiness only comes for big
projects, and I don''t expect to using Perl quite that
way.
Perl wins when it comes to one-liners and maybe replacing shell scripts.
As I tend to forget the syntax of bash''s scripting language easily, I''ve
replaced it entirely with Perl.

Perl''s bad reputation for big projects is probably due to the variance
of those people using Perl. One large group is sys-admins who use Perl
in an entirely different way as compared to someone building larger
systems. However, there are enough very large Perl projects that show
that it can be used for that just as easily (at least as long as one
keeps the sys-admins away from the source;-).
I''ve seen mention of parrot and perl6, which is quite a
ways off. I''m not sure how much that should weigh into
my decision, since it isn''t real yet.



It shouldn''t. Perl6 is mostly yet another leap towards fitness for large
projects. I don''t think it will gain much for those more hackish tasks.
Also, no one quite knows when Perl6 will be due.

Tassilo
--


_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_


这篇关于为我的特定利基选择Perl / Python的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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