Perl Vs Python
Derek Thomson
dthomson at NOSPAMusers.sf.net
Thu Feb 27 07:35:07 EST 2003
Bo M. Maryniuck wrote:
> On Wednesday 26 February 2003 02:05, John Smith wrote:
>
>>Hello:
>> do Perl & Python do similar things?
>> What should be the rationalle to one or the other?
>
>
> - Try to read your own Perl code one year later and
> you'll be surprised how *ugly* Perl is.
I've had no such problem. And I read other's Perl code, and people read
mine with no problem. Perhaps you just don't write very good code to
start with? ;)
> - Perl is not ObjectOriented. It *looks like* OO.
Rubbish. I suspect you're just parroting something you've read somewhere.
> - You can not provide the bytecode for end-customer
> if you would not like to show him the sources.
For a start, compilation != encryption. Without some kind of evil DRM,
you have to accept that the only way to prevent the user "stealing" your
IP is through contracts and licenses. Therefore, you might as well make
the code available anyway.
Secondly, you *can* do this for Perl. You use the B::Bytecode backend
plugin to generate byte code for any given sample of Perl code. You can
also "freeze" the Perl process after it's finished compiling your
source, and ship that executable.
> - Do you like this schizophrenic syntax?:
> map{($_[0])?s/\s\s+/,/gs:$_;($?)?push(@M,$_):$_;(/wap:/)?$?=$$:$_;}split($/,`cat /proc/meminfo`);
>
I could construct obfuscated examples in Python if I so desired.
Especially with list composition syntax :) This proves nothing.
> <IMHO>
> - Perl is fast (interpreter), but not designed for big applications.
> It is good for scripts up to 100 codelines.
> </IMHO>
>
Sorry, but you're completely wrong here. Perl is compiled into an
intermediate form, just like Python. Perl's speed (for certain usage
patterns) actually comes from the fact that the "virtual machine" is
higher level (closer to the language) than Python's is. For example
"grep" is an operand, IIRC!
As for the 100 line limit, I have no such problem, and I've never met
any capable programmer who did. I use it for "big applications", and
there are many examples of such things, so your argument is provably
incorrect.
This kind of stuff doesn't do anything to make Python and its user
community look particularly clueful. Quite the opposite, in fact.
Instead, make a reasoned argument based on facts, rather than just
regurgitating myths, legends and FUD that you've read somewhere else.
Regards,
Derek.
More information about the Python-list
mailing list