[Python-ideas] Anonymous blocks (again):

Terry Jan Reedy tjreedy at udel.edu
Tue May 14 23:24:47 CEST 2013


On 5/14/2013 1:34 PM, Haoyi Li wrote:
> Andrew, I agree with 100% of what you said; you put it much more clearly
> than I could.

Ditto.


> #soapbox
> My point in stirring up all this is that we should not confuse
> "empirically bad" with "unpythonic". It is fine to reject something just
> because it's unpythonic, and does not fit into the rest of python's
> ecosystem, and it's fine to reject something because it is empirically bad.
>
> However, it is a mistake to say something (e.g. method chaining) is
> empirically bad *because* it is unpythonic.

I would almost say that doing so is unpythonic ;-).

Method chainging in itself *is* python when done, for instance, with the 
subset of string methods that return a string. I am sure that one can 
find things like f.read().string().lower() in the stdlib. This gets to 
Andrew points.

As for your soapbox issue: People sometimes misuse Tim Peter's Zen of 
Python points. He wrote them to stimulate thought, not serve as a 
substitute for thought, and certainly not be a pile of mudballs to be 
used to chase people away. I regard 'python' versus 'unpythonic' much 
the same way. Misused, but with a proper use. I occasionally use it as a 
summary lead in followed by an explanation ('I think this is unpythonic 
in that ...').

And by the way, as for your macro module: I like that Python can be and 
is used to do 'crazy' things, even if I think something is too crazy for 
the stdlib. (I also notice that standards change. Metaclasses were 
originally a crazy hack. If I remember correctly, they were formally 
supported as part of unifying types and classes. 10 years later, we are 
just adding the 1st stdlib module use thereof.)

--
Terry Jan Reedy




More information about the Python-ideas mailing list