Earlier quoted context omitted.
Basically I was hoping to use it for functions that wrap others. E.g setup something and then pass the kwargs through to the other function.
If I understand you correctly, I think ParamSpec (since 3.10) is what you are looking for, especially if you want to be generic over the type of the inner function. The example from the docs ( https://docs.python.org/3/library/typing.html#typing.ParamSp... ): from collections.abc import Callable from typing import TypeVar, ParamSpec import logging T = TypeVar('T') P = ParamSpec('P') def add_logging(f: Callable[P, T])…
Python 3.12
321–330 of 344 posts
Re: Python 3.12
#322Earlier quoted context omitted.
It's not an anti-feature. Those languages gained popularity in part because they were dynamically typed. But this debate is decades old and people always dogmatically choose one side, so not really any point in trying to convince you. Alan Kay made the argument back in the 1970s that type systems were always too limiting, therefore classes and late binding were the answer for him.
I’m speaking from my real-life lived experience with dynamic typing. I feel that dynamic typing is truly harmful for any project that involves involving complex logic, needs collaboration / where there’s more than 1 person working on it, or even for any large project (even if only 1 person is working on it). It was a massive waste of time to have to read piles of code code, use a debugger and inspect object structure…
Re: Python 3.12
#323Earlier quoted context omitted.
I recently took part A of Dan Grossman's Programming Languages' course, and he focus on Standard ML which is strongly-typed. It was enlightening to learn about, and after completing Part A, I too felt that any language that lacks type safety can't be a serious language. I recently started using Python again for a side project, and I had forgotten how good of a dev experience Python offers. I wish I could explain bett…
I appreciate the thoughtful response, despite my comment being less then that. With that said, I am using Python in production for a line business app for a 2 billion dollar company now. I can't imagine why anyone would use this for a multi-team project outside of areas where it's the language with the most libraries(IoT, ML). Not only is there the type safety issue, the standard testing and ORM libraries are way beh…
Re: Python 3.12
#324I'm just happy for itertools.batched for chunking iterables: https://docs.python.org/3.12/library/itertools.html#itertool...
there's 1-2 other stuff from more_itertools that I think should make it to itertools. I'd actually like to see statistics from huge monorepos/opensource about usage stats of various more_itertools functions.
Re: Python 3.12
#325Earlier quoted context omitted.
> Either copy/paste or rolling them into config objects and passing those down is generally preferable Preferable for whom? I do not prefer it. I much prefer to avoid the extra work it creates for me vs. the simplicity of kwargs. I use explicit args for the function I made and then add *kwargs on the end and then I don't have to write bespoke config objects or copy and paste a bunch of stuff that might be obsolete by…
Preferable for those who would use your code. If it’s just you then it’s your exclusive preference. If you have users, args/kwargs is going to be more opaque than a more explicit option. For code with many users, creating a few extra minutes of work for one dev is preferable when the alternative would be every dev who uses that code has to spend that same extra work and then some to grok what exactly is going on with…
Re: Python 3.12
#326Everything aside, I enjoyed the "And now for something completely different" part.
I don't think political advocacy belongs in an announcement of a Python version.
Re: Python 3.12
#327Re: Python 3.12
#328I wish they make it possible to use any, callable builtins for type annotations
You can. def foobar(things: list[tuple[int, Floob | None]]) -> dict[int, int]): Possible since 3.11 I think, maybe even 3.10.
Re: Python 3.12
#329Earlier quoted context omitted.
It's a less complicated version of multiprocessing because you don't have to deal with multiple processes and all the complexity that that entails. It's basically web workers / isolates for Python.
It looks more complicated. You get the same cumbersome communication primitive (channels), except now native code can easily get messed up. And it requires more care when developing the interpreter itself. Using multiprocessing was actually pretty easy (apart from the communication primitives, which obviously suck).
> You get the same cumbersome communication primitive (channels), except now native code can easily get messed up.
I'm not sure what you mean by that. Native code has to be thread safe sure, but now it also can be thread safe! You can have native code that is actually properly multithreaded. A big win.
> And it requires more care when developing the interpreter itself.
Maybe. Not really an issue for the user though.
Re: Python 3.12
#330I don't know much about the internals of python (or compiler theory stuff), but it would be cool to productionize a script with types and make a static binary out of it. pypy/mypy and other projects are fine but they don't support latest python versions and libraries. I want the ease of python but fast once you lock down the dynamic programming features.
Kind of a crazy project but the "just go ahead and import any Python module and we'll embed the VM in your binary" approach is interesting, at least.