Thanks for not trimming it down for the stupid youtube algorithm.
@DavidDellsperger Жыл бұрын
This was great, I look forward to getting to play with these in 3 years when python 3.12 is a few months from EOL
@amir.hessamАй бұрын
@DavidDellsperger glad to see familiar faces here ...
@SebaSalinas91 Жыл бұрын
Thanks for all the amazing content you share with us... Pretty cool that you get to work in core python projects and even talking to Guido! Cudos for you! Looking foward to use your pre-commit library, im still figuring it out.. Greetings from Chile!
@con-f-use Жыл бұрын
Yeah, it's very nice of you to explain this, thanks. Cuts down the time to research it oneself. You'll have to do it for professional reasons anyway, I guess, so mighty fine to spend the extra time, make a video, and save some strangers collective days of tedium.
@pylang3803 Жыл бұрын
def x[T, U, V](y: U, z: V) -> list[T]: pass *holds head*
@RedShipsofSpainAgain Жыл бұрын
2:13: infinitely nestable f-strings 9:16 the modules that are going away: 'distutils' module; 11:48: the 'imp' module 12:45 type variables/parameters/aliases (allows Generics to be specified easier)
@Gaivs Жыл бұрын
To me, the point of itertools.batched _is_ that the final "element" can contain fewer elements! Many algorithms are memory intensive, so being able to cap the number of elements for each batch means you can limit how many subelements are handled, rather than being a zip-replacement. So rather you would have: for batch in itertools.batched(it, 2): if len(batch) == 1: process_one(batch[0]) elif len(batch) == 2: process_two(batch) else: continue Or something smarter. In machine learning fields, this is a common way to handle training data, and while there are other tools for this there, it is nice to have a python implementation for this. As recently as a week before the release of python 3.12 I had to install the more itertools package to get this function for a project.
@henryschreiner Жыл бұрын
You did the $ variables in pdb correctly, they stay between stack changes, not continuing execution (they are cleared then). batched doesn’t error, you were unpacking it assuming it returned the same number each time. For its use case (batching items for multiprocessing), that’s exactly what you want and it’s a benefit over the existing helpers. Just don’t unpack assuming identical batch sizes. :)
@acidnynex Жыл бұрын
Was this use case really the primary reason for its inclusion in the standard library? I've done this using grouper from more_itertools for years, there is also so much more additional nice functionality in that package that it would be nice to have had a bit more of it included in the standard library.
@Squeemos Жыл бұрын
Oooh that's what I was wondering about as well. Seeing something that can help do batches for me (without weird math to get me there) is really handy, since I typically use a whole batch at a time rather than unpacking! Neat!
@StepanKabachkov Жыл бұрын
This new generics syntax and the type keyword is just a shocker honestly. Couple more versions - and the language becomes non-recognizable to people used to 3.7 or something :)
@theendlessriver13 Жыл бұрын
Yeah - that also hit me as looking just "wrong" - but I'll get used to it I guess...
@ac130kz Жыл бұрын
nah, just a few touches
@peculiar-coding-endeavours Жыл бұрын
Basically generics syntax is now closer to what it is in many other languages. What a shocker
@noobling8313 Жыл бұрын
Just don’t use the syntax unless it’s fun.
@aaronater1088 Жыл бұрын
Appreciate the dissect on what's comin. Neat find on the NUL byte too
@RuslanKovtun Жыл бұрын
You are making amazing videos and I'm watching them not for fun but as an actual short/dense overview of new features or some tweaks and tricks. I have learn a lot from your videos. I appreciate your work.
@amir.hessam Жыл бұрын
I love the fact that Anthony mostly wings his videos! Very cool ♥
@Squeemos Жыл бұрын
Great video! The function annotations look... goofy. However I'm glad to hear that list comps (and I assume dict comps as well, but I'd have to look) got a speedup that seems relatively trivial!
@d3stinYwOw Жыл бұрын
Removal of distutils can hurt only in one circumstance - where you don't have access to pip at all, and you're stuck with whatever standard library can provide to you, either as learning excercise or your boss have panic attack when hears about anything 'third-party' :)
@_Ani_ Жыл бұрын
Thanks for the overview Anthony, a fun and insightful video as always!
@soberhippie Жыл бұрын
Generics are now more in line with those in Java and Rust, which is nice. Does isinstance work if you declare something as that type explicitly? Like `type MyType = int; a: MyType = 2; isinstance(a, MyType)`?
@anthonywritescode Жыл бұрын
no. type hints aren't part of the runtime like that they're mostly just comments
@piyushgupta7210 Жыл бұрын
that's just amazing.. thanks for taking out time and giving an overview of cool features of 3.12
@DorkOrc Жыл бұрын
I can’t say I understood a lot of this, but it was very good background chatter to put on while mindlessly programming, so thank you for helping me focus haha
@swapnilchavan7076 Жыл бұрын
Amazing content. I love to watch your videos. You are so informative. Thanks for doing this. I appreciate your efforts. 🙏
@lucasfcnunes Жыл бұрын
In ISO 8601 monday is the start of the week + Week with weekday notation e.g. 2023‐W32‐1 is a monday
@alexandrugheorghe5610 Жыл бұрын
Thank goodness for that. No offense, but I can't stand the week starting on a Sunday!
@mrc1500 Жыл бұрын
Quite like the Generic types overhaul. I gave a wry chuckle and wondered when Python would become Scala 😏
@hardikojha220 Жыл бұрын
Unpacking of the TypedDict is a blessing
@yorailevi6747 Жыл бұрын
Can someone add timestamps? A tldr and a way to jump into detail is really helpful
@bernardcrnkovic3769 Жыл бұрын
i was just wondering what was the use case for nested f-strings? I feel like it is satisfying to allow any combination of quotes in nested expressions but I can't think of use case for nested ones.
@catcatcatcatcatcatcatcatcatca Жыл бұрын
My guess would be that now you can have an uggly general formatting string bound to a symbol, expand it with one fstring and then call that new fstring. I have not tried this, but my idea would look something like: Charlie=“charlie_stateA” f’{f’{Charlie}_3’}’ to exapand the variable charlie_stateA_3 Basically what this allows is manipulating the command or symbol the outer f-string will expand. It’s kind of a macro, and does what eval would do. Just thinking this makes my head hurt a bit, so I’m not sure if I will even bother trying it. But you might be able to “generate” an anonymous function with combining different symbols, and then evaluate that with-in the larger f-string. Like you could use a symbol to determine what lambda-function you will use to filter a list, and just do that inside an f-string. So in short, think of the most cursed way to use eval you can imagine. Now you can do that all within a single f-string. I feel very very sorry for anyone who is better of having this feature available, but for sake of completeness it makes sense to add.
@TankorSmash Жыл бұрын
Informative and engaging, thanks for uploading. I love the nice error messages.
@Phaust94 Жыл бұрын
Thanks for the video! Love it! Love your style! The features not so much tho
@18Maxim1811 ай бұрын
Thanks for the video, I waited for override decorator, as in my project we wrote it by our own. Minus one shitty func in our repo)
@traal Жыл бұрын
I like the override decorator. Explicit is better than implicit, right? 😊
@alexandrugheorghe5610 Жыл бұрын
I'm totally on board with you!
@princeroshan4105 Жыл бұрын
I added those enums in calendar 😁, that was I guess my first PR to Cpython.
@niazhimselfangels Жыл бұрын
Thanks, man! 😃
@pratyushrath1457 Жыл бұрын
Great work! Keep contributing.
@RedShipsofSpainAgain Жыл бұрын
Good job! Kinda of amazing that Python has had this bug for 23 years. How did no one think to fix this sooner??
@princeroshan4105 Жыл бұрын
@@RedShipsofSpainAgain It was not a bug. It was 2 unnecessary variables exposed in module namespace because it was required in many functions inside the module, that's why it was kept global, No one thought that somebody will use it, but few of them are using it. Now we have added a deprecation warning for the same.
@RedShipsofSpainAgain Жыл бұрын
@princeroshan4105 Ahh ok thanks for explaining. But why were only 2 months needed? Seems like an arbitrary number of months to require. Couldn't they have just added the other 10? Why stop at 2 months? Why not 3? Or 7?
@j.i.-cruz Жыл бұрын
hyped for the vid! chapters would be super helpful
@anthonywritescode Жыл бұрын
I'll edit them in at some point!
@alexandrugheorghe5610 Жыл бұрын
@@anthonywritescodedon't forget about us. I'm saving this video for future reference
@jrheard Жыл бұрын
❤ for casual inheritance diss ❤❤
@DrSnej Жыл бұрын
There is no mention of the changes to GIL in py3.12 in this video.. why? It seems like quite a change, would like to hear your insight on it.
@anthonywritescode Жыл бұрын
that's not until 3.13 at the earliest
@piotrbogdanski8785 Жыл бұрын
Great content as always! What about PEP 684? Looks like it's listed as one of the major changes in the release notes for 3.12 and sounds quite cryptic to me, I'd love a video about this
@anthonywritescode Жыл бұрын
most people don't care -- subinterpreters is mostly for embedding python
@sadhlife Жыл бұрын
Instead of /dev/stdin you can just not give tokenize any file argument and it'll default to stdin
@windowviews15010 ай бұрын
Cool kb. What is it? freestyle pro?
@user-kn4wt Жыл бұрын
really enjoyed this! thanks for all your videos 🙏🙏
@MakeDataUseful Жыл бұрын
Generics is a little scary looking!
@maxvangent4171 Жыл бұрын
With the new f-string parsing we can finally write php in python 🙃
@mrswats Жыл бұрын
Always love these, so I know what to tell my colleagues about the new python version!
@catcatcatcatcatcatcatcatcatca Жыл бұрын
Better typing-syntax is great, we want more typing but less typing. Similarly improved error messages help with learning and sleep deprivation. The new itertool change also allows doing some very satisfying but pretty cursed stuff. Just have a list that contains lists of anonymous functions and some structure of values, in alternating fashion, and call those functions on the values in some meaningful way. and now this one line of code runs sets of functions on a list of values, then a different set of functions on a different list of values, and so on. You will feel so smart when you get it to work properly. This can compeletely replace classes and I bet everyone reading the code is throughoutly impressed. Or you can use it to parse a list in chunks like a normal person.
@daineminton9687 Жыл бұрын
...oof... the nested f-string is nice, but seems to me it'll get pretty messy very quickly. Makes me wonder if you could pull a walrus op inside f-string... gonna play with 3.12 later This is oddly interesting behavior. Running below... arr = '1 1 2 1'.split() f"nums are: {f'{" ".join([str(y) for _ in arr if (y:=int(_) + 3) == 5])}:{" ".join([str(y) for _ in arr if (y:=int(_) +3) == 4])}'}" Returns below... 'nums are: 5: 4 4 4' Code looks clunky, hard to read, & quotations seem to be very touchy when switching between single & double marks. Tested this in pre release 04 of version 3.12 but it works.
@asrk3855 Жыл бұрын
I am new to this channel When I first saw thumbnail I was like, why is attorney tom talking about python
@Md.AlmasAli Жыл бұрын
Excellent introduction! ❤
@IvanHabunek Жыл бұрын
Cool video, thanks!
@dangerousdansg Жыл бұрын
Great video, I learnt so much!
@Adherbal22 Жыл бұрын
Thanks dude what a great content ❤❤❤
@rudranagkatroju9970 Жыл бұрын
Hey Anthony. Can you explain how to add a custom function to python builtins.
@rosmelylawliet Жыл бұрын
I love pyupgrade, i use it regularly
@simdimdim Жыл бұрын
10:37, just me or was that you keying in your password on camera?
@debakarr Жыл бұрын
Some of these like the f string and generic type is really hard to read. Just wondering what impact will it have in libraries like Pydantic. Btw, you are one of the coolest person in the Python community.
@atugushev Жыл бұрын
Thanks for great changelog!
@atugushev Жыл бұрын
Really enjoyed the video. Pretty excited by @override and typed kwargs. And pre-commit now in cpython, wow this is win! It's fun that pdb became php xD
@desertfish74 Жыл бұрын
Why the square brackets for the generic type variables where everyone else is using less than and greater than brackets for that…?
@anthonywritescode Жыл бұрын
some other languages do that too -- plus there's already presence in python for squackets
@avasam0611 ай бұрын
Small typo in chapters: - 9:18 "distutels" - 29:47 "Pi upgrade"
@anthonywritescode11 ай бұрын
I haven't added chapters -- those are generated
@avasam0611 ай бұрын
@@anthonywritescode uh, found it curious I couldn't find the timestamps in the description. I didn't know KZbin autogenerates chapters.
@Soulthym Жыл бұрын
Line 269 of pdb.rst after commit 7db9d37... in issue 103694 says: "The*convenience variables* are cleared when the program resumes execution so it's less likely to interfere with your program compared to using normal variables" Looks like this is the reason it wasnt defined after you resumed :)
@djazz0 Жыл бұрын
Finally, more months lol
@putnam120 Жыл бұрын
But why the f string change? Makes no sense to me
@skarfie123 Жыл бұрын
The batched function is still useful if you just don't unpack in the for loop
@qexat Жыл бұрын
don't forget to link the video about generics :P
@destinyinworld4064 Жыл бұрын
Thanks 🎉
@funkdefied1 Жыл бұрын
At this point the Python std will just be a wrapper around C.
@cparks1000000 Жыл бұрын
19:45 I'm not impressed that the new type aliases don't work with "isinstance".
@funkdefied1 Жыл бұрын
Both the type alias and the generic typing syntax looks just like Rust.
@w2lkm2n Жыл бұрын
You exposed your sudo password at 10:37
@anthonywritescode Жыл бұрын
it's "bad password"
@computerfre3 Жыл бұрын
Did you just enter your root password on camera?
@anthonywritescode Жыл бұрын
it's "bad password" -- I intentionally use a bad password here because of this
@desertfish74 Жыл бұрын
@@anthonywritescodemine is 8 asterisks
@MyriadColorsCM Жыл бұрын
I think pygame no longer works in 3.12 because of the distutils deprecation.
@kosmonautofficial296 Жыл бұрын
I HATE MARCH!
@commandcracker42 Жыл бұрын
WOW Python became JS ._.
@qexat Жыл бұрын
override is all nice until the linter reports missing `override` on bare class methods like `__repr__` 💀
@qexat Жыл бұрын
frob
@yomajo Жыл бұрын
What's the practical use for these type vars ..? Is this how core devs are fighting AI? by making language unreadable? Deeply saddened.
@raymondpearson1971 Жыл бұрын
"promosm" ✋
@DrDeuteron Жыл бұрын
This typing has got to stop
@yomajo Жыл бұрын
These hipsters introduce new typing shit, that doesn't even work with builtins like isinstance. It's ridiculous. As if bunch of javascript devs flooded core and started making decisions.
@Jason-b9t Жыл бұрын
I think it is for optimization considerations and consistency, the original type hints are always cannot be used at runtime.