Python advocacy in scientific computation
Steve Holden
steve at holdenweb.com
Wed Mar 8 01:27:12 EST 2006
Andy Salnikov wrote:
> "Michael Tobis" <mtobis at gmail.com> wrote in message
> news:1141750637.180979.69890 at j33g2000cwa.googlegroups.com...
>
>>>Indentation
>>>makes all kinds of inlined code extremely clumsy or practically
>>>impossible
>>>in Python.
>>
>>This is the only sensible argument against the indentation thing I've
>>heard. Python squirms about being inlined in a presentation template.
>>Making a direct competitor to PHP in pure Python is problematic.
>>
>>While there are workarounds which are not hard to envision, it seems
>>like the right answer is not to inline small fragments of Python code
>>in HTML, which is probably the wrong approach for any serious work
>>anyway. This problem does, however, seem to interfere with adoption by
>>beginning web programmers, who may conceivably end up in PHP or perhaps
>>Perl Mason out of an ill-considered expedience.
>>
>>Why this should matter in this discussion, about scientific
>>programming, escapes me though.
>>
>>When you say "all kinds" of inlined code, do you have any other
>>examples besides HTML?
>>
>
> Makefiles is one example. Shell script containing snippet(s) of
> Python code is another one.
>
> At one time I also tried to make a simple "configuration file"
> engine based on Python for a big Framework used in one physics lab.
> Idea was to have a Python extension for that C++ framework and
> to configure the Framework from Python code, like:
>
> # Module means C++ Framework module, not Python
>
> Module1.param1 = "a string"
> Module2.paramX = [ 1, 2, 3 ]
> # etc., with all Python niceties.
>
> People who were using this Framework were all hard-core physicists,
> some of them knew Fortran, many were exposed to C++. There were
> few other "languages", some of them home-grown, used for different
> tasks, but none of these mentioned languages ever placed so much
> significance on the whitespaces. There were some big surprises for
> people when they discovered they can't arbitrary indent pieces of
> the above configuration files because it is all Python code. Add
> here space/tabs controversy if it is not enough yet to confuse
> poor physicist fellows :) I think that config file project was killed
> later in favor of less restrictive format (I left the lab before that,
> can't say for sure.)
>
I just hope this remains a "someone made a poor choice of configuration
language and trained the users inadequately" story, and does not
transmogrify into a "Python is bad" story.
You mention makefiles and shell scripts as contexts unsympathetic to
Python's indentation requirements, but frankly you don't see much code
in any language except shell inlined in these contexts.
Given the makefile's requirement that significant leading whitespace be
tabs and not spaces and you have a recipe for disaster inlining any
language.
regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC/Ltd www.holdenweb.com
Love me, love my blog holdenweb.blogspot.com
More information about the Python-list
mailing list