[Python-Dev] pep8 reasoning

Steven D'Aprano steve at pearwood.info
Fri Apr 25 05:55:49 CEST 2014


On Thu, Apr 24, 2014 at 01:57:38PM +0100, Tim Golden wrote:
> On 24/04/2014 12:59, Tal Einat wrote:
> > As far as I know that reason for these examples being frowned upon is
> > that they are needlessly redundant. 
> 
> Oh, the irony! (Sorry, couldn't resist)

Not really ironic, since not all redundancy is needless.

Useful redundancy: an emergency backup chute; if your main parachute 
fails to release, you have a backup. RAID. Backups in general. There's a 
lot of redundancy in human language in general, which makes it possible 
to understand speech even in noisy enviroments.

Needless redundancy: a double-headed spoon, in case the first bowl 
disintegrates in your soup, just turn the spoon around and use the 
spare. Or the abuse of Hungarian Notation perpetrated by the Windows 
development team.

http://www.joelonsoftware.com/articles/Wrong.html

One mild but legitimate criticism of Python's significant indentation 
feature is that it loses some useful redundancy: you can reconstruct the 
indentation from the braces, or the braces from the indentation, but if 
you only have one, and it gets lost in transmission, you're screwed.

(The lesson of this, as far as I am concerned, is "Don't transmit source 
code through noisy channels that delete parts of your code.")



-- 
Steven


More information about the Python-Dev mailing list