OSDir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Python-Dev] Slow down...


On Mon, May 07, 2018 at 10:23:32PM +0200, Antoine Pitrou wrote:
> On Mon, 07 May 2018 19:19:28 +0000
> Ryan Gonzalez <rymg19 at gmail.com> wrote:
> > 10 years feels like a simultaneously long and arbitrary limit. IMO a policy
> > of "try to avoid major language features for a while" would work better.
> 
> I would remove "for a while".  "Try to avoid major language features"
> sounds good.

It sounds good, until you ask about "What if we had that policy from 
the beginning?"

Let's see what sort of language features we would miss out on if we 
avoided language features because there was an existing alternative:

- async/await ("use the asyncio library")

- comprehensions ("just write a loop")

- True/False builtins ("just define your own constants at the top
  of the module")

- f-strings ("just use str.format")

- yield from ("most of the time you can just use 
  ``for x in thing: yield x``, the rest of the cases are
  too obscure and unimportant to justify new syntax")

- with statements and context managers ("just use a try...
  finally")

- ternary if ("just re-write it as a if...else block, or use
  the ``x or y and z`` trick")

- closures ("just write a class")

- yield as an expression for sending values into a generator
  (a pre-async kind of coroutine) ("just write a class")

- function annotations ("just use one of three or four competing
  standards for docstring annotations")


The only language feature I can think of that had no way of doing it 
before being added to the library was Unicode support.

So we'd effectively have Python 1.5 plus Unicode.

If we could look forward to 2028, when we're running Python 3.14 or so 
(4.7 if you prefer), how many fantastic language features that we cannot 
bear to give up would we be missing out on?



-- 
Steve