how to avoid leading white spaces

rurpy at yahoo.com rurpy at yahoo.com
Tue Jun 7 14:37:15 EDT 2011


On 06/06/2011 08:33 AM, rusi wrote:
> For any significant language feature (take recursion for example)
> there are these issues:
>
> 1. Ease of reading/skimming (other's) code
> 2. Ease of writing/designing one's own
> 3. Learning curve
> 4. Costs/payoffs (eg efficiency, succinctness) of use
> 5. Debug-ability
>
> I'll start with 3.
> When someone of Kernighan's calibre (thanks for the link BTW) says
> that he found recursion difficult it could mean either that Kernighan
> is a stupid guy -- unlikely considering his other achievements. Or
> that C is not optimal (as compared to lisp say) for learning
> recursion.

Just as a side comment, I didn't see anything in the link
Chris Torek posted (repeated here since it got snipped:
http://www.princeton.edu/~hos/frs122/precis/kernighan.htm)
that said Kernighan found recursion difficult, just that it
was perceived as expensive.  Nor that the expense had anything
to do with programming language but rather was due to hardware
constraints of the time.
But maybe you are referring to some other source?

> Evidently for syntactic, implementation and cultural reasons, Perl
> programmers are likely to get (and then overuse) regexes faster than
> python programmers.

If by "get", you mean "understand", then I'm not sure why
the reasons you give should make a big difference.  Regex
syntax is pretty similar in both Python and Perl, and
virtually identical in terms of learning their basics.
There are some differences in the how regexes are used
between Perl and Python that I mentioned in
http://groups.google.com/group/comp.lang.python/msg/39fca0d4589f4720?,
but as I said there, that wouldn't, particularly in light
of Python culture where one-liners and terseness are not
highly valued, seem very important.  And I don't see how
the different Perl and Python cultures themselves would
make learning regexes harder for Python programmers.  At
most I can see the Perl culture encouraging their use and
the Python culture discouraging it, but that doesn't change
the ease or difficulty of learning.

And why do you say "overuse" regexs?  Why isn't it the case
that Perl programmers use regexes appropriately in Perl?  Are
you not arbitrarily applying a Python-centric standard to a
different culture?  What if a Perl programmer says that Python
programmers under-use regexes?

> 1 is related but not the same as 3.  Someone with courses in automata,
> compilers etc -- standard CS stuff -- is unlikely to find regexes a
> problem.  Conversely an intelligent programmer without a CS background
> may find them more forbidding.

I'm not sure of that.  (Not sure it should be that way,
perhaps it may be that way in practice.)  I suspect that
a good theoretical understanding of automata theory would
be essential in writing a regex compiler but I'm not sure
it is necessary to use regexes.

It does I'm sure give one a solid understanding of the
limitations of regexes but a practical understanding of
those can be achieved without the full course I think.



More information about the Python-list mailing list