What's New In Python 3.12

  Рет қаралды 83,029

Indently

Indently

Күн бұрын

What are the new features that are coming in Python 3.12? Well, first of all it's worth mentioning that Python 3.12 will be release on 2023-10-02 (from what I read), so we still have some time until it comes out. But otherwise there are a lot of cool new features to learn about!
▶ Become job-ready with Python:
www.indently.io
▶ Follow me on Instagram:
/ indentlyreels
00:00 Intro
00:30 Highlights
00:44 Improved error messages
01:37 Syntactic formalisation of f-strings
03:12 Comprehension inlining
03:37 The buffer protocol
03:56 A per-interpreter GIL
04:48 More precise **kwargs typing
05:04 Override decorator
05:47 Type parameter syntax
06:49 Learning more about 3.12
07:10 What do you think?
07:25 Outro

Пікірлер: 75
@vinhlo2637
@vinhlo2637 11 ай бұрын
I love how they add the override decorator, it makes the code clearer and easier to read.
@cranberry888
@cranberry888 11 ай бұрын
do I understand correctly that this new decorador is just syntax sygar right? It could override methods before, but with this decorador it just get hinting and check
@nicolasc.1968
@nicolasc.1968 11 ай бұрын
​@@cranberry888correct. Writing a method in a child class with the same name and number of arguments would override it without the need for the decorator.
@Indently
@Indently 11 ай бұрын
I'm excited to cover these features in more detail when they come out in the stable release of 3.12!
@SkyFly19853
@SkyFly19853 11 ай бұрын
Python has so much potential. Especially for video game development.
@LeWolfYT
@LeWolfYT 11 ай бұрын
i can’t wait for 3.12 to release. in a perfect world there would be an easier way to migrate python.
@djixi98
@djixi98 11 ай бұрын
2:43 Whoever was writing these notes is obviously a fan of Sleep Token! Phenomenal band that everyone should check out!^^
@Indently
@Indently 11 ай бұрын
Someone else mentioned this, but I didn't know they were referring to a band when they mentioned "token". I thought I was missing out on some programming features. I will check it out!
@carloscorrea260
@carloscorrea260 11 ай бұрын
It is interesting how languages that didn´t use types now use types, i was a "not types lover" because not using types allows you to be more "flexible", but not anymore, types are importan, maybe not in small projects but in bigger projects when you work with others, types matter a lot
@Andrumen01
@Andrumen01 11 ай бұрын
For the multiline f-strings, extremely useful when using functions with multiple parameters. For example using Path (from pathlib), where you have a really long path that can span multiple lines. That is extremely useful!
@DrDeuteron
@DrDeuteron 11 ай бұрын
how is pathlib different from os.path? What am I missing.....
@Andrumen01
@Andrumen01 11 ай бұрын
@@DrDeuteron ??? Why the question?
@DrDeuteron
@DrDeuteron 11 ай бұрын
cause I don't want to RTFM
@Indently
@Indently 11 ай бұрын
I don't mean to intrude, but now I'm curious as well, but not curious enough to search it 😂 (I will search it now)
@Indently
@Indently 11 ай бұрын
According to the first google search: The os module represents paths as strings with which you cannot do much. The pathlib module represents paths as special objects with useful methods and attributes. Source: builtin.com/software-engineering-perspectives/python-pathlib#
@vorpal22
@vorpal22 11 ай бұрын
Definitely happy to see an override decorator and the easier generics. Otherwise, I'm not really as excited about this release as I was about some of the others.
@EpicNoobx
@EpicNoobx 11 ай бұрын
i'm so excited for this update!
@Mr.Derpus
@Mr.Derpus 11 ай бұрын
I love the SleepToken references in the code
@Whatthetrash
@Whatthetrash 11 ай бұрын
Very cool!
@Lol52UK
@Lol52UK 11 ай бұрын
Appreciate the timestamps
@ClaudioBOsorio
@ClaudioBOsorio 11 ай бұрын
I really like the hype on these things. Although I dont use Python extensively this should be like the patch notes everyone reads for games. Lets see what's new and what are the new features that can help us out
@Ierzi
@Ierzi 11 ай бұрын
Can your first video on python 3.12 be on the new type statement?
@mbokil
@mbokil 10 ай бұрын
Have been testing out RC 2 it the performance is really nice. Excited about this release for October
@thisoldproperty
@thisoldproperty 11 ай бұрын
Not sure if it's something you'd like to cover.. installing 3.11 or 3.12 onto a Linux distribution that already has a default python version installed. Some might find it useful.
@snesmocha
@snesmocha 11 ай бұрын
It’s a quick Google search how to use pip to update your python version though
@dmitripogosian5084
@dmitripogosian5084 11 ай бұрын
What's the problem ? On Gentoo you can have many concurrent versions of Python
@miguelguthridge
@miguelguthridge 11 ай бұрын
Those easier generics look awesome!
@filippavlovic18
@filippavlovic18 11 ай бұрын
Didnt expect Sleep Token as an example for f-strings lol
@djixi98
@djixi98 11 ай бұрын
just commented that myself, guess they're pretty popular rn! Good on them^^
@vmr_1997
@vmr_1997 11 ай бұрын
lmao jumped my eye too, cool!
@AntonioZL
@AntonioZL 11 ай бұрын
The per-interpreter GIL is what I'm anticipating the most!
@moondevonyt
@moondevonyt 11 ай бұрын
hey fam, i've got mad respect for your effort in breaking down the new features in Python 3.12 you've got a killer way of explaining things and it's dope to see you staying updated with the latest releases but real talk, while these updates are fresh, sometimes i wonder if Python's trying to pack in too many features makes it harder for newcomers and even some seasoned devs to keep up. like, sometimes less is more, you feel me? but still, keep these vids coming cause they're straight fire
@mmmhorsesteaks
@mmmhorsesteaks 11 ай бұрын
Nothing forces you to use them. Or even teach them to newcomers. Maths classes also don't start by throwing the kitchen sink at you... But on the off chance they are useful to you, they are there.
@dapodix
@dapodix 9 ай бұрын
Wouldn't you make this observation to any advancement in tech (or beyond) today? Sure, every project has to innovate and change is constant - it's how change is pushed out that makes it a quality hallmark of the successful/enduring projects. You can still program in the older python 2-ish style and get quite far that way - lots of codebases are set up this way today. If you'd like to push envelopes and stop walking through treacle - you make code relevant, interesting, concise, readable with newer features available to you in the language.
@dinoscheidt
@dinoscheidt 11 ай бұрын
2:57 well these nested f-strings are certainly great at enabling more SQL injections….
@medicallyunexplainedsymptoms
@medicallyunexplainedsymptoms 11 ай бұрын
Soldering - don't tin the tip of the iron before soldering. It should clean and shiny when presented to the work. Tinning the tip burns off the flux that is supposed to help the process before you actually need it, and can make the solder a bit 'second hand'. 1. Clean tip 2. Heat up the joint you're soldering with the clean tip (uniformly - heat everything you are soldering) 3. Add solder and let it flow. More heat may be needed 4. Remove solder 5. Remove iron 6. Clean and tin the iron. Adding solder to the tip for when the iron's in the stand stops it going dull. (I do electronics for a living, and used to build aerospace hardware.)
@MrSongbird
@MrSongbird 11 ай бұрын
All the f-string changes are huge and feel so long overdue.
11 ай бұрын
Huh, Python Dev is a fan of Sleep Token, nice.
@adrienc8716
@adrienc8716 10 ай бұрын
what about its speed compared to 3.11 ? Do we have a % increase somewhere ??
@abhishankpaul
@abhishankpaul 11 ай бұрын
We came this far, I think variable type declaration should be used asap. Python wastes a lot of time to check data type of variables inside loops and functions. I mean, we can just add a bunch of lines to tell Python which variable is what
@Danielagostinho21
@Danielagostinho21 11 ай бұрын
How do you update python easily? Last time I did it it was quite tedious, install the new version from website, change path variables and then reinstall the modules from the old version to the new version with pip. Is there a better way to do it?
@xappz
@xappz 11 ай бұрын
use virtual environments. each project should have its own python version and packages pinned with a requirements file, that way other people can run your code, or maybe even you in the future when coming back to an old project that ran on older versions.
@python-programming
@python-programming 10 ай бұрын
I nest F strings all the time. This is so nice! (Although I've never nested 6 f-strings. Challenge accepted! =)
@tigerbojiteol
@tigerbojiteol 11 ай бұрын
What’s the benefit of using typing class over dataclasses since dataclasses has more feature and functionalities. Why isn’t Python foundation opting dataclasses as built-in module?
@lorenzomonacelli
@lorenzomonacelli 11 ай бұрын
The removal of distutils is a terrible strike. Much more work to migrate from python 3.11 to 3.12 than it was between python 2 and 3 for me.
@SusanAmberBruce
@SusanAmberBruce 11 ай бұрын
I'm interested, if you were doing something with GUI, would you use tkinter for that or what?
@KeithKazamaFlick
@KeithKazamaFlick 11 ай бұрын
CustomTKinter
@Geraldonimosito
@Geraldonimosito 11 ай бұрын
Dearpygui is very nice too
@naveennamani2
@naveennamani2 11 ай бұрын
PySimpleGUI
@DrDeuteron
@DrDeuteron 11 ай бұрын
2:42 in-line comments in a continued line? I shall cast the 1st stone.
@banatibor83
@banatibor83 11 ай бұрын
So python copies go routines from golang :) Better multithreading will definitely benefit python. On the other hand I do not understand the TypeDict nonsense. If you have to inherit from TypeDict and create a class, why do not just pass an instance of that class? Kwargs just make the code unreadable.
@xlerb_again_to_music7908
@xlerb_again_to_music7908 11 ай бұрын
My simulation systems are process speed bound. All these new features look nice, but will they speed things up? The sub-interpreter with its own GIL may be useful (but all I did before was to use command line to start a new python instance, so that got its own GIL - thus no real speedup available for me). I want more speed; python is the slowest of the modern languages :(
@saadahmed688
@saadahmed688 11 ай бұрын
If you wanted speed then why didn't you go with rust, go, c++ or even java?
@xlerb_again_to_music7908
@xlerb_again_to_music7908 11 ай бұрын
@@saadahmed688 sunk costs. My uni was using python in 2013, and I hadn't coded for 25 years. It was easier to go with the flow and build skills not used since my pascal days; after a few years python was my go-to. If I was starting over, I'd use nim (closer to C but using very python syntax). FYI the goal was to get a doctorate and python was an enabler; a stepping stone to build a simulator the like that had not been seen. In the end I needed 4 PCs running for 18 months on a 106 k line python codebase, delivering 10,000 very accurate EV simulations per thread per second to achieve what I wanted. Many would not have considered writing a system so big (all by my hand - coding took nearly 3 years including test and system verification), but I was coding since the late '60s and have tackled several large projects. Pythons interactive nature greatly sped development, but runtimes were terrible and memory management on Windows caused problems. As in, Windows ignores gc releases until the process parent dies => hog city. Well, in 2.7 that was the case...
@dmitripogosian5084
@dmitripogosian5084 11 ай бұрын
You should not be using python for speed bound parts of your project
@xlerb_again_to_music7908
@xlerb_again_to_music7908 11 ай бұрын
@@dmitripogosian5084 so sorry; I didn't have a spare 3 years to write it again. Development speed was paramount. The work was to a time limit, and yes I did try alternatives available in the Uni (and having support from the computing profs was important). Matlab was the major alternative but succumbed quickly to the stresses of a real project. Back in that day, lots of problems including type sensitivity in compound structs. If you defined a new type with several elements, like in C, Matlab insisted that each type was written / assigned variables _in the same sequence._ That is, with a compound type instantiated with 3 elements a, b, c as a1, b1, c1 and a2, b2, c2 ...to interoperate they must be assigned values (post creation) in the same order. Changing a1, c1 then a2, c2 all OK. But if you had set c2 then a2 (with the same values) the type system declared this new alien thing had a different type to a1, b1, c1; working between them now forbidden! That was enough for me on top of other problems; Matlab binned. And as said, if starting now I'd use nim. But hindsight is a wonderful thing! :)
@rupaksaha9050
@rupaksaha9050 11 ай бұрын
How can we update to python 3.12? Please make a video.
@Indently
@Indently 11 ай бұрын
I can make a video when 3.12 is released
@user-zp7ey1sl5b
@user-zp7ey1sl5b 11 ай бұрын
Slowly moving towards C++, hah :)
@robertobokarev439
@robertobokarev439 11 ай бұрын
**Make true unsafe multithreading in Python with exceptions of deadloop, race condition etc.** Guido: Nah **Invent new feature sucking out your memory even more no one's gonna use because Cython exists** Guido: Hell yeah!
@rusektor
@rusektor 11 ай бұрын
It's strange, but @override didn't work for me
@ScienceD9000
@ScienceD9000 11 ай бұрын
That decorator is just documentation, it does not do anything
@ameliabuns4058
@ameliabuns4058 11 ай бұрын
by the looks of how fast python is improving python 4.0 is gonna be 10x faster than C (JK obviously)
@EmanueleX
@EmanueleX 11 ай бұрын
did they seriously just add typedef from c lol
@WLockIV
@WLockIV 11 ай бұрын
AWS lambda support in 2030
@tmahad5447
@tmahad5447 11 ай бұрын
lol snail
@HitBoxMaster
@HitBoxMaster 11 ай бұрын
PyTorch still isn't on 3.11 lmao
@zyxyuv1650
@zyxyuv1650 11 ай бұрын
Why can't we remove the conservative old parts of Python that make it un-JIT-able? It's not like removing that stuff makes any difference in reality. Just look at PyPy, it's not like PyPy is actually crippled in any way, except for compatibility. And compatibility isn't that important when there's the opportunity for a major version number change. Python could be JIT-able in V4 and we're going to BLOW IT...come on people, organize
@AP-dc1ks
@AP-dc1ks 11 ай бұрын
Pithon hahaha
@JarppaGuru
@JarppaGuru 9 ай бұрын
do we care if same code works and not annowing this is changed. if it faster then who cares lol
@Patrick1985McMahon
@Patrick1985McMahon 11 ай бұрын
Python is still ugly.
@AlexandreSenpai
@AlexandreSenpai 11 ай бұрын
PYTHON WITH GENERIC TYPING OMFG 🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡🫡
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 35 МЛН
Happy 4th of July 😂
00:12
Alyssa's Ways
Рет қаралды 69 МЛН
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
МЯТНАЯ ФАНТА
Рет қаралды 6 МЛН
It's time... for PYTHON 3.11!
8:10
mCoding
Рет қаралды 151 М.
5 Good Python Habits
17:35
Indently
Рет қаралды 453 М.
New Features You Need To Know In Python 3.12
12:04
ArjanCodes
Рет қаралды 179 М.
Python 3.12 is HERE!
12:37
mCoding
Рет қаралды 157 М.
20 Everyday Tips & Tricks in Python
25:18
Indently
Рет қаралды 18 М.
Python dataclasses will save you HOURS, also featuring attrs
8:50
"TypedDict" In Python Is Actually AWESOME!
7:32
Indently
Рет қаралды 28 М.
PLEASE Use These 5 Python Decorators
20:12
Tech With Tim
Рет қаралды 103 М.
You Are Going To Like These New Features In Python 3.11
10:58
ArjanCodes
Рет қаралды 159 М.
One moment can change your life ✨🔄
00:32
A4
Рет қаралды 35 МЛН