Print

Print


On Wed, Oct 27, 2010 at 9:28 PM, Alexander Johannesen
<[log in to unmask]> wrote:
>> From my experience, it seemed php was a server side
>> scripting language.
>
> Strictly speaking, so is Python.

Actually, Python is a general purpose programming language. It was not
created specifically for server side scripting like PHP was. But it is
very suitable to that task.

> Not seen any scientific packages, but I've seen a few ray-tracers,
> although they're all demo apps and fun toys (although I think that
> applies to Python, too).

No, that does not apply to Python. Python is widely used for hardcore
scientific computing.

It is also the most important scripting language in large scale CGI
settings, used in companies such as Indusrial Light & Magic, Weta
Digital and so on. Python has become so important for CGI in recent
years that Autodesk had to embed Python in its Maya application even
though Maya has always had its own embedded scripting language, called
MEL.

Nuke, a red hot 3D compositor that was massively used in the
production of Avatar, is completely scriptable in Python. In fact, its
entire UI Is made with Python.

http://www.thefoundry.co.uk/products/nuke/

> You can bind PHP and Python the same, it's just a matter of doing and
> whether it makes sense to do so. It's *not* a question of /if/ you can
> do it, but if you /should/ do it. Your milage *will* vary.
>
>>>  For the sophisticated hacker, most languages can
>>> be tweaked to solve almost any problem.
>>
>> I am sure that is true. Though, I feel many for many tasks php would
>> require quite a bit more tweaking than python, with much less
>> community support behind it (I mean, google comes up with fewer
>> helpful links to the problems I sited above).
>
> Maybe your Google-foo is weak. :)

Or maybe he's just realizing that outside of server side web
scripting, PHP is just not so widely used.

> Anyway, I wasn't meaning to promote PHP over Python, just pointing out
> that PHP is a lot more (and more often still, a lot better) than what
> most people think it is.

Having used both languages, I discovered that Python is easier for
most tasks, and one reason is that the libraries that come with Python
are extremely robust, well tested and consistent. PHP is very
practical for server-side web scripting, but it's libraries are
unfortunately full of gotchas, traps and unexpected behaviour.

A key reason for that is the fact that Python has always had an
exception-handling mechanism while PHP has grown something like that
only a few years ago, and many libraries don't use it, so whenever you
call a function you never know whether the result will be a real value
or some error code. This is very error-prone and testing for errors on
many calls makes the program logic harder to follow.

So, I my opinion, PHP is great at what it does best: enabling quick
server-side Web scripting on almost any hosting service on Earth.

For everything else, it is very worthwhile to learn and use a general
purpose dynamic language such as Python, Ruby or Perl.

Sorry for the rant. I must confess I am a founder of the Brazilian
Python Association and was its first president, so you can call me a
Python advocate.

-- 
Luciano Ramalho
programador repentista || stand-up programmer
Twitter: @luciano