Is there an easy way to control indents in Python

Simon Kennedy sffjunkie at gmail.com
Mon Oct 20 17:54:46 CEST 2014


On Saturday, 18 October 2014 11:53:16 UTC+1, Steven D'Aprano  wrote:
> I'm curious what aspect of idiomatic Perl code you are referring to. When
> people talk about Perl code dismissively, I normally think of three things:
> 
> - excessively long one-liners;
> - excessive use of symbols and sigils ("line noise");
> - "More Than One [Thousand] Ways To Do It"

I'll preface the following by stating that I program in Python as a hobby and that the only programming I've done professionally was a few years ago now and consisted of a Visual Basic style language (Wonderware Intouch) and a piece of software called ABB Sattline.

Not having ever attempted to go beyond even the basics of Perl, the aspect that causes me to refer to Perl 'dismissively' as well comment in this thread, is that I don't find Perl to be an aesthetically pleasing language and I consider Python functions which have no blank lines in them to be a small step towards Perl.

Some people do not like Python's indentation rules but for me it's a large part of what draws me to program in Python. Spaces for indentation and blank lines are both aspects of how I like to program. 

I write in Python because I like to, not because I have to.

I think the only reason I might code a function with no blank lines was if I was programming in a language that using blank lines caused it to run too slowly.
 
> Are you suggesting that Perl functions tend to be too small? What do you
> consider "too small"?

No function is "too small". A one line function if it helps to describe the higher level code where it is called is fine by me.



More information about the Python-list mailing list