Python advocacy in scientific computation

Andy Salnikov a_salnikov at yahoo.com
Wed Mar 8 01:13:29 CET 2006


"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.)

  Andy.




More information about the Python-list mailing list