[Python-ideas] As-do statements/anonymous blocks in python

Jonathan Fine jfine2358 at gmail.com
Sat Jul 28 10:54:31 EDT 2018

Hi James

This is an attempt to respond to the issues that be lying behind your
request for code blocks in Python. It's my two cents worth
(https://en.wikipedia.org/wiki/My_two_cents) of opinion.

I really do wish we could have language that had all of Ruby's
strengths, and also all of Python's. That would be really nice. Quite
something indeed.

But most strengths, in another situation, can be a weakness. Language
design is often a compromise between conciseness and readability, ease
of use and performance, good for beginners and good for experts, and
many other factors. Such as innovation and stability.

Guido's decisions, as BDFL, have shaped Python and its community into
what it is now. It is one set of compromises. Other languages, such as
Ruby, have made different compromises. Now that the BDFL is on
vacation, the challenge is to maintain the essence of Python while
continuing to innovate.

Python's compromises and implementation give the language a large sweet spot.
The sweet spot is a place where a combination of factors results in a
maximum response for a given amount of effort.

Languages do influence each other. Ruby is good at internal Domain
Specific Languages (DSLs). And there's Perrotta's influential book on
Ruby Metaprogramming. That's something I think Python could learn

But I don't see any need (or even benefit) in adding new language
features to Python, so it can do better at DSLs. It's fairly easy to
write a decorator that turns a class into a dictionary of 'code
blocks'. I think that might be what you really want.

I'd be pleased to hear what you have to say about this.

with best regards


More information about the Python-ideas mailing list