News for hackers. Stuff that matters.
Re:Modern Pandas (Part 2): Method Chaining by ok_dad on Sunday May 01, 2022 @04:45PM (#31228511)
> pattern matching expressions

Available in 3.10: https://peps.python.org/pep-0636/

> syntax for partial application...

    from functools import partial

    somefunc_arg1_arg2 = partial(somefunc, arg1, arg2)
> ...and composition

A native compositional syntax would be nice.

> a typing system which can express structural types

    # mypy will typecheck this code and see `MyString()` has a `.read()` method, so it's a `Readable` even though it doesn't sub-class `Readable`

    from typing import Any, Protocol

    class Readable(Protocol):
        def read(self) -> Any: ...

    def read_something(something: Readable) -> Any:
        return something.read()

    class MyString:
        a_string: str = "something"
        def read(self) -> str:
            return self.a_string

    read_something(MyString())
> a generalised list comprehension

I agree this would be nice.

Re:Modern Pandas (Part 2): Method Chaining by mjburgess on Monday May 02, 2022 @06:12AM (#31233215)
they arent expressions, defeating the whole point

that isnt syntax for partial appication, and the protocol system for structrural typing is syntactically and practically absurd

the question is "why do data processing libs in python look syntactically illegible" and the answer is largely, as youve posted above, that python doesnt support useful syntax