News for hackers. Stuff that matters.
Re:Python’s tug of war between beginner-friendly and advance... by peterkelly on Friday February 05, 2021 @01:54AM (#26033820)
> I seriously cannot think of anything I could do to exceed Python.

Just off the top of my head:

- Pattern matching

- Multi-line lambdas

- Proper variable capture in lambdas and inner functions (as was fixed with the 'let' keyword vs 'var' in recent versions of JavaScript)

- Support for cyclic imports (a bad pattern in general but necessary in some cases)

- A well-defined C API for extensions that doesn't get them too entangled in the internals of CPython. This would make it possible for other implementations to reach the level of library support that CPython enjoys.

Re:Python’s tug of war between beginner-friendly and advance... by kazinator on Friday February 05, 2021 @04:45PM (#26041615)
Pattern matching is in PEP 635, created Sep 12, 2020.

Multi-line lambdas can be sort of obtained in Python by defining a progn function:

https://news.ycombinator.com/item?id=19933223

Re:Python’s tug of war between beginner-friendly and advance... by maxs on Friday February 05, 2021 @02:52AM (#26034075)
I would say proper variable scoping in general. It would be awesome to have let variables in python!
Re:Python’s tug of war between beginner-friendly and advance... by zo1 on Friday February 05, 2021 @03:08AM (#26034149)
Variables are scoped just fine from my point of view. What do you mean by proper?
Re:Python’s tug of war between beginner-friendly and advance... by maxs on Friday February 05, 2021 @03:17AM (#26034185)
I meant to say block scoped. Variables in python have function or global scope but no global scope. E.g. you can say

   for x in ...:
and then use x outside of the loop.
Re:Python’s tug of war between beginner-friendly and advance... by knighthack on Saturday February 06, 2021 @07:47AM (#26046169)
I have no idea why you would want to declare an x in the loop, and then use it outside the loop. There are better ways of doing things.

The fact that you can do such a thing in JavaScript is exactly why JavaScript is such a mess of a language with its globally-declared and hoisted variables.

That sort of practice has never made sense, and is not a language design that Python should follow.