Question about indentation and bugs

Garth Grimm garth_grimm at hp.com
Thu Aug 23 17:11:19 EDT 2001


The only issue we've had with this is our scripts that contain both Python
and HTML.  When having translators translate the text of the web page, we
were terrified that they'd do things like open the file in some editor that
would break the indentation of the python pieces.  So we developed a process
where we could ship the HTML text components off in a separate file and then
re-merge the python scripting logic with the HTML pieces that came back.
With source code that wasn't white space sensitive, we might have tried not
setting up the process.

Nevertheless, if the code is expected to have to change hands, I'd certainly
recommend Python over Perl.

--
Garth


"Dave Swegen" <dswegen at allstor-sw.co.uk> wrote in message
news:mailman.998577160.2781.python-list at python.org...
> First of all this is not intended as flame-baiting or trolling. I'm
> genuinly curious about this one weird feature.
>
> I've recently started looking at python, as we are about to implement a
> whole new intranet, and it would seem that basically all web tools that
> are of interest (zope, mason etc) are either perl or python based.
>
> Now, I've done a bit of perl coding, and it does have some neat
> features. However, I feel that there are far too many cases where making
> hard-to-read code is too easy, or things feel tacked on (OOP, for
> instance). That is why I really like what I've seen of Python so far.
>
> However, I (and others here at work) do have some real concerns about
> the indentation feature. Basically we are quite worried about subtle
> but nasty bugs creeping in. Take the following code for instance:
>
> for i in [1234]:
> print i
> print "hello"
>
> Perfectly fine, valid code. But one indentation step wrong, and you end
> up with perfectly fine, valid code that does something else, ie
>
> for i in [1234]:
> print i
> print hello
>
> I imagine that these sort of problems might not only appear due to
> incorrect coding, but also things such as broken mailers, applying
> patches from people using different indent levels etc
>
> So my question (or rather questions) is this: In practice, how often do
> such problems crop up?  How does one go about avoiding such problems? Is
> there any way at all to make explicit where a block ends?
>
> Any points of view much appreciated
>
> Cheers
> Dave
>





More information about the Python-list mailing list