No video

Python 3.12 is HERE!

  Рет қаралды 157,756

mCoding

mCoding

Күн бұрын

Пікірлер: 289
@NotAUtubeCeleb
@NotAUtubeCeleb 10 ай бұрын
The comprehension change is a 10/10. Literally no change to your code required but comprehensions become twice as fast.
@LambOfDemyelination
@LambOfDemyelination 10 ай бұрын
twice?
@BrianWoodruff-Jr
@BrianWoodruff-Jr 10 ай бұрын
Looking forward to my coworkers comprehending twice as fast!
@ianliu88
@ianliu88 10 ай бұрын
I guess this also allows comprehensions to be evaluated in pdb session? Dunno, must test
@nigh_anxiety
@nigh_anxiety 10 ай бұрын
Haven't checked it yet, but does this also mean that a list comprehension for a class variable can now reference are pre-defined class variables? Previously it would fail as class definitions are not an enclosing scope.
@yourmomsboyfriend3337
@yourmomsboyfriend3337 10 ай бұрын
This is so cool, I can’t wait to use this in 2027 when it’s supported by all packages and about to be depreciated
@anon-fz2bo
@anon-fz2bo 10 ай бұрын
cant wait till cpp23 is fully supported in 3023 ⚰️
@squarerootof2
@squarerootof2 9 ай бұрын
Can't wait for humanity to be deprecated in 2030 and AI controlled cyber-organisms taking over the world.
@danmar007
@danmar007 9 ай бұрын
It's deprecated, but it's still funny.
@jamesflames6987
@jamesflames6987 10 ай бұрын
Great to see Python taking some inspiration from C++ such as typing and incomprehensible syntax.
@headlikeahole6548
@headlikeahole6548 10 ай бұрын
Types in C++ affect your programs, in python they are just for IDE hints.
@jamesflames6987
@jamesflames6987 10 ай бұрын
@@headlikeahole6548All of the complexity, none of the functionality.
@tuberroot1112
@tuberroot1112 10 ай бұрын
@@headlikeahole6548 " in python they are just for IDE hints." Even hints would be better than the instanity of gender fluid variables and non binary booleans !!! Python is a mess on every level.
@nagoranerides3150
@nagoranerides3150 10 ай бұрын
@@jamesflames6987 But they've really internalised the lesson from C++ that you can say you're OO without having to actually enforce it, so you can still have functions floating around any old place and of course none of the flow-control is OO at all. But, you know - whitespace!
@squarerootof2
@squarerootof2 9 ай бұрын
@@jamesflames6987 LOL,🤣
@K0nomi
@K0nomi 10 ай бұрын
the f string change is so helpful, ive run into that one quite a few times
@user-tc1ue4gt1h
@user-tc1ue4gt1h 10 ай бұрын
I usually use f"""{"somthing"}"""" if the double quote cannot be avoided. But usually f"{' something '}" would get the job done. Also use f"{{ {something} }}" when dealing with some command prompt requires {} as parameters.
@NoNameAtAll2
@NoNameAtAll2 10 ай бұрын
you've run into using quotes inside quotes and deciding not to escape them?
@wChris_
@wChris_ 10 ай бұрын
im already excited for python pi (or just python 3.14) as it is now very very close
@Liam3851
@Liam3851 10 ай бұрын
Ever since python 2 went out with python e (2.7.18), I've been thinking it would be aesthetically pleasing for the python 3 line to end with 3.14.15. Perhaps if GIL removal by default gets released as Python 4...
@obed818
@obed818 10 ай бұрын
@@Liam3851cant wait for it’s end really..
@matthias916
@matthias916 10 ай бұрын
pithon
@jan-lukas
@jan-lukas 10 ай бұрын
Did python 1 stop with 1.414?
@Liam3851
@Liam3851 10 ай бұрын
@@jan-lukas 1.6.1. Golden ratio!
@rx97_mc
@rx97_mc 10 ай бұрын
I think with `kwargs`, it's not that having the same type for each `kwarg` is a natural solution but it's more like it's consistent with the typing of `args` where it *does* make more sense to have the same type for each arg.
@SuperGrimmy
@SuperGrimmy 10 ай бұрын
As someone who maintains a lot of packages.. 3.7 disappearing is definitely the best. Can we fast track it to 3.10? :D
@nigeltan7766
@nigeltan7766 10 ай бұрын
is python 3.7 bad? im no expert but am curious so pls elaborate
@sid6645
@sid6645 10 ай бұрын
Losing 3.8 might be bad because of nvidia, as someone pointed out below.
@SuperGrimmy
@SuperGrimmy 10 ай бұрын
@@nigeltan7766 It would be "bad" to use it now since that version is no longer getting any updates including security fixes. Newer versions have the new language features and much better performance anyway.
@SuperGrimmy
@SuperGrimmy 10 ай бұрын
@@sid6645 yes, I the real world it would definitely be premature to fast track deprecation. It's just something some python package maintaners dream about because it can greatly reduce their work.
@aintaintaword666
@aintaintaword666 10 ай бұрын
And I'm still using 3.6 for an old custom-build tensorflow version that was specifically compiled to run on an ancient GPU
@lawrencedoliveiro9104
@lawrencedoliveiro9104 10 ай бұрын
6:30 Just a note that, as with any function, generation of the code happens only once, at compile time, but creation of the function _object_ (ref to code + environment binding) happens every time that statement is executed.
@stonemannerie
@stonemannerie 10 ай бұрын
As an NVIDIA Jetson which shipped Ubuntu 20.04 (i.e. python38) and lots of proprietary NVIDIA libraries which only have python binding for 3.8, I start sweating at the thought of 3.8 being dropped next year.
@cleverclover7
@cleverclover7 10 ай бұрын
you're not alone
@volbla
@volbla 10 ай бұрын
Let's update them 🙂
@Squeemos
@Squeemos 10 ай бұрын
I know exactly what you mean. As much as I love the new features of updates to python I get really worried the closer 3.8 gets to being dropped haha. Too many things would stop working for me :(
@SuperGrimmy
@SuperGrimmy 10 ай бұрын
You'd probably be fine for a couple more years until 2025 when ubuntu 20.04 LTS standard security maintenance also runs out. Probably Nvidia calculated it based on that. That's definitely within reason. Most consider a newly deprecated python version to have year or two more in them in enviroments like that.
@tuberroot1112
@tuberroot1112 10 ай бұрын
@@volbla "Let's update them ". Let us .... ? That will be you and who else picking up the burden of the massive work load imposed by the lamers at Python constantly doing non compatible "upgrades" and breaking everything in sight?
@Kruglord
@Kruglord 10 ай бұрын
11:51 There's exactly one problem with `itertools.batched`, it's passed tense. All the other itertools are present tense, i.e. `groupby` rather than `groupedby`.
@negativeseven
@negativeseven 10 ай бұрын
I read it as an adjective, rather than a verb. Like functools.partial.
@simp-
@simp- 10 ай бұрын
never thought of that before, but It's pretty much same as in build-in python functions sorted() and reversed(). I mean we have ex. not mapped() but map(); not enumerated() but enumerate() tho I have never see anyone complain about it, even tho it's kinda not consistent
@piaIy
@piaIy 10 ай бұрын
​@@simp- Sorted and reversed are different, they suggest that the collection is not modified in place, but a copy/iterator is returned, whereas you can't really map or enumerate in place. As for batched, I think they chose that name because batch can also be interpreted as a singular noun. Kotlin also uses the name chunked for a similar method, and their naming conventions are pretty consistent.
@simp-
@simp- 10 ай бұрын
@@piaIy oh, okey I get it, thanks a lot
@Darmo_
@Darmo_ 10 ай бұрын
The new generic type syntax is sooo welcome
@con-f-use
@con-f-use 10 ай бұрын
1:52 and it used to be that you coudln't use backslashes in f-strings. Which bit a lot of people in the backside.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 10 ай бұрын
10:14 That would need a “@final” decorator on the base class method. No doubt that will be coming ...
@peco_17
@peco_17 10 ай бұрын
Actually, @final is already in the `typing` module since python 3.8 ;)
@lawrencedoliveiro9104
@lawrencedoliveiro9104 10 ай бұрын
@@peco_17 Ha!
@Ballrock30
@Ballrock30 10 ай бұрын
Hi James, if you are gathering points for a new "Nooby Python habits" video, I might have one. Not sure if I missed it in the list or it is just so stupid that you did not think about it. In most of my codes I initialized instance attributes as class attributes instead of initializing them in the __init__() method. Mainly to make the code shorter and more readable. I mean, sure... Those are shared by all instances of a class, but if they are immutable objects they work like instance attributes. I realized my very stupid nooby habit when I created mutable objects (list and dict in my case) which is then shared between all instances. I think for newcomer this behavior is not quite obvious and can lead to silent misbehavior. I thought it is worth mentioning. Thank you for your great videos. Even considering the statement above, I'd say they made me a quite good Python dev :)
@cougar2013
@cougar2013 10 ай бұрын
Please let the 3.14 release be called “Pi-thon” 😂
@cardboard952
@cardboard952 9 ай бұрын
uyese
@cleverclover7
@cleverclover7 10 ай бұрын
8/10 video. im gonna start using itertools batched. f string stuff was annoying having to use different quotes, etc. kinda wish single-quotes in python weren't a thing.
@michaelflynn6952
@michaelflynn6952 10 ай бұрын
I just wish they did something different than double quotes, feels like wasted opportunity to make two characters do the same thing
@RokeJulianLockhart.s13ouq
@RokeJulianLockhart.s13ouq 10 ай бұрын
​@@michaelflynn6952Yeah. Almost every other scripting language has different handling for the two characters.
@nocturnomedieval
@nocturnomedieval 10 ай бұрын
Would like to hear more about your other preferred utils. How is batched implemented over an unindexed object, does it cast to a list or uses a generator ?
@pranavbhamidipati8609
@pranavbhamidipati8609 10 ай бұрын
Generator. Unlike batched_even which needs the iterator length, batched does not
@Tomyb15
@Tomyb15 10 ай бұрын
The buffer protocol is nice. Many times I've come across functions in the standard library that say they work with anything that implements the buffer protocol, when it's C api only and only bytes and bytearray implement it. Not that useful but kinda nice.
@codegeek98
@codegeek98 10 ай бұрын
2:05 spooky, I literally just got bit by that this morning; I had no idea that's being/been addressed
@foobar8894
@foobar8894 10 ай бұрын
Only two more to go until we can start calling it πthon...
@Terra_135
@Terra_135 10 ай бұрын
10:15 PUBLIC STATIC VOID MAIN STRING ARGS 🗣‼
@rursus8354
@rursus8354 4 ай бұрын
10:26: C++ typing is a good thing! Typing has the two purposes of 1. helping the programmer catch errors, 2. creating an efficient compiler producing lightning fast machine code (if the programmer chooses to). If the answer on purpose 2. is "use another language" then Python isn't that language.
@calum.macleod
@calum.macleod 10 ай бұрын
"and python 3.8 has a year to go so I can start pushing clients to upgrade to 3.9" :D
@sethdhanson
@sethdhanson 10 ай бұрын
Been waiting for a 3.12 take from mCoding. Awesome!
@southernsunreviews5932
@southernsunreviews5932 2 ай бұрын
On types or dictionary question you asked about. In c# we have enums that you r able to cast the value or str. And values could change depending on what the enum is used for. Then you want to use kwargs because you don't know how the structure changed. Like in reflection scenarios. Thanks great update And you explanation about square and override is a nice explanation of polytechnic methods if they were wondering how polymorphism relate back to real life scenarios instead of foo
@volbla
@volbla 10 ай бұрын
I also have had to write my own batched function. Since itertools has pairwise you might think it should also have an n-wise, but not so until now.
@danmar007
@danmar007 9 ай бұрын
Finally!!! I've been waiting for this to start learning Python.
@norude
@norude 10 ай бұрын
Static type gang here 👇
@thomasbates9189
@thomasbates9189 9 ай бұрын
How did you learn about all the python language features you currently know how to use and what motivated you to learn them? Many times I watch your videos and I see you use something that I wasn't aware of before like __slots__ and other items like that.
@georgplaz
@georgplaz 10 ай бұрын
as someone who learned programming with java, the new generics make me so happy 😊
@gautam-narula
@gautam-narula 9 ай бұрын
Getting ready for the next billionaire to be someone who made “don’t Java my Python” bumper stickers
@recoder706
@recoder706 10 ай бұрын
Looking forward to 3.14 version. I hope they gonna call it Pi-thon
@l3gacyb3ta21
@l3gacyb3ta21 10 ай бұрын
woa! I love the static typing stuff
@MrAlanCristhian
@MrAlanCristhian 10 ай бұрын
Override is my favorite. I love it.
@joshuaraciti
@joshuaraciti 9 ай бұрын
Can’t wait for Py 3.14
@hglbrg
@hglbrg 9 ай бұрын
Finally a youtuber who knows how to pronounce et cetera properly. You deserve a like just for that.
@bswck
@bswck 10 ай бұрын
one of the best updates ever
@Creadeyh
@Creadeyh 10 ай бұрын
Is the debugger improvement applied to the integrated vscode debugger or do you have to use the sys.monitoring yourself ? Sorry I don't really know how debuggers work internally
@WesYarber
@WesYarber 9 ай бұрын
Bump
@tomasbernardo5972
@tomasbernardo5972 10 ай бұрын
Can't wait for python 3.14, python π
@NithinJune
@NithinJune 10 ай бұрын
Love this form of video with the ratings! Very engaging...
@SniperMayer
@SniperMayer 10 ай бұрын
I really hope 3.14 will be named Pithon
@plagosus
@plagosus 10 ай бұрын
I'll be waiting for 3.14
@felixfourcolor
@felixfourcolor 10 ай бұрын
The generic typing is the best! I'm disappointed of the performance though. 3.11 vs 3.10 was a clear upgrade, while 3.12 barely changes, some programs run even slower.
@trag1czny
@trag1czny 10 ай бұрын
Great vid as always 🎉
@bswck
@bswck 10 ай бұрын
discord gang 🤙
@IterativeTheoryRocks
@IterativeTheoryRocks 8 ай бұрын
Marvellous. Loved it.
@sehaless
@sehaless 10 ай бұрын
Not that I have a use case for it, but I am curious. How do immortal objects actually work? Is there a way from within python to mark an object as immortal or is that fully up to the C implementation to handle - so only code that is partially C can benefit from it atm?
@betterinbooks
@betterinbooks 10 ай бұрын
new way of creating types is a huge change.
@danielgysi5729
@danielgysi5729 10 ай бұрын
I can't decide if a smaller update like this with less new syntax is refreshing or boring
@prawnydagrate
@prawnydagrate 10 ай бұрын
man you are literally the best python programmer i've ever seen
@BosonCollider
@BosonCollider 10 ай бұрын
Immortal objects would be a no-op in pypy. Refcounting is just inherently ugly if you care about performance at all. I wish that python3 had just dropped refcounting and used a proper GC in python.
@rasputunga
@rasputunga 10 ай бұрын
`batched` function is GOAT
@seifenspender
@seifenspender 10 ай бұрын
These changes all sound amazing.
@bearwolffish
@bearwolffish 10 ай бұрын
wonderful update
@maxgtheone
@maxgtheone 10 ай бұрын
Missed a great opportunity to put the Twitter logo at 9:00 haha
@Balaji-qq9lc
@Balaji-qq9lc 10 ай бұрын
I really hope python will be called as Pie-thon when 3.14 is released
@19DonCorleone87
@19DonCorleone87 10 ай бұрын
Thank you for the summary. It was super useful. The rating at the end of ever ysection feels kind of subjective and arbitrary.
@lukekurlandski7653
@lukekurlandski7653 10 ай бұрын
I love python type hints, but not gonna lie, without rigorous type checking, I’m skeptical whether this kind of “advanced” typing is actually useful…
@MephistoDerPudel
@MephistoDerPudel 10 ай бұрын
Immortal objects may be useless to most projects, but for those, for which it is a problem, it may resolve a bit PITA.
@Vivraan
@Vivraan 10 ай бұрын
10:25 you forgot noexcept(noexcept(L)) lol
@ivancota9762
@ivancota9762 10 ай бұрын
Can't wait for 3.14 - Python Pi 😊
@mattlau04
@mattlau04 10 ай бұрын
I was waiting for release really patiently, the new type syntax and f-string syntax are such amazing changes
@jadencorr6897
@jadencorr6897 10 ай бұрын
kwargs typing is useful for framework-like code. Because it is not obvious which parameters are accepted by **kwargs.
@RichardHamnett
@RichardHamnett 9 ай бұрын
Can't wait for 3.14 - then we'll have Piithon
@sabihass5361
@sabihass5361 10 ай бұрын
Thank you!
@notplancha131
@notplancha131 8 ай бұрын
0:47 is (float, int) here mean that T will be a tuple, or will it be either a float or int?
@Jeyekomon
@Jeyekomon 9 ай бұрын
It would be awesome if you made a video about generic functions!
@wizpig64
@wizpig64 10 ай бұрын
Love your music by the way
@_-_--_
@_-_--_ 10 ай бұрын
great video. thank you
@kareemmika6210
@kareemmika6210 10 ай бұрын
The new generic type syntax looks like GO. and i love it actually
@k98killer
@k98killer 10 ай бұрын
I don't get why you would type hint kwargs that way instead of just type hinting the named kwargs after the "/, *," in the function signature, e.g. "def thing(self, /, *, kwarg1: int, kwarg2: str)"
@curtmcd
@curtmcd 10 ай бұрын
Good stuff. Generics have come a long way. Now we need currying. Nits: is that min_max generic at 0:13 supposed to return triples? And at 0:49 shouldn't it return self.seq[item] or something?
@FrederikSchumacher
@FrederikSchumacher 10 ай бұрын
Currying has long been in Python: functools.partial or functools.lru_cache
@lawrencedoliveiro9104
@lawrencedoliveiro9104 10 ай бұрын
We already have function factories and class factories. What more do you need?
@kirilplatonov4423
@kirilplatonov4423 10 ай бұрын
Batched finally here! I no longer have to produce weird magic tricks with iterator multiplication
@IamusTheFox
@IamusTheFox 10 ай бұрын
Wow, python has changed a lot. I learned 3.1 and haven't had a reason to keep in the last few years
@nikhildaram3354
@nikhildaram3354 10 ай бұрын
Streamlit is not available in python 3.12
@HoangoKidZero
@HoangoKidZero 4 ай бұрын
Hmm... A video on Python 3.12 with a slightly over 12-minute runtime :D
@SourabhBhat
@SourabhBhat 10 ай бұрын
For me the new Generic syntax and @override is 10/10. The generic syntax would have made it easier for me to read though!
@FrederikSchumacher
@FrederikSchumacher 10 ай бұрын
You are aware that anything in Python is a generic? "def foo(bar)" means bar is generic (as is the return value). It's not untyped either, because of "object" being the base for all Python values? There's only limited amount of usefulness in something like "[X where Parent]" as documentation.
@lawrencedoliveiro9104
@lawrencedoliveiro9104 10 ай бұрын
I think the C++ syntax was stupid. And it still doesn’t let C++ (or Java, for that matter) expression Python concepts like function factories and class factories.
@SourabhBhat
@SourabhBhat 10 ай бұрын
@@FrederikSchumacher Yes. Python is too generic, which doesn't allow to express the intent of the programmer. The generic specification is just a hint for IDEs to check the sanity of the code. For example, a class of type T, has methods that adhere to the same type T.
@JohnFallot
@JohnFallot 10 ай бұрын
Let's gooooo!!!
@my_master55
@my_master55 10 ай бұрын
My crazy mind though mathematicians just dropped a new Pi value 😭😂
@tuberroot1112
@tuberroot1112 10 ай бұрын
Can't wait for Python v 3.14159 running on Raspberry pi.
@rodrigof.5956
@rodrigof.5956 10 ай бұрын
Just two versions left
@twentytwentyeight
@twentytwentyeight 10 ай бұрын
Feeling like the error message update has been a long time coming, wonder if rust launching with readable traceback added to the push
@TheSkepticSkwerl
@TheSkepticSkwerl 10 ай бұрын
Python doesn't have static types. Now we need generics? Wtf
@avasam06
@avasam06 10 ай бұрын
You mentionned setuptools. But not that *distutils* is completely removed from 3.12! setuptool still monkey-patches in its special vendored version. But that means if you never imported setuptools, then imports of distutils will fail.
@CppExpedition
@CppExpedition 10 ай бұрын
Best reviewer 🎉 :)
@rutabega306
@rutabega306 10 ай бұрын
Yo the next version is 3.14 thats dope
@dailynarative
@dailynarative 10 ай бұрын
im strugle to find pyaudio for this version of python3.12
@Jake9066
@Jake9066 10 ай бұрын
Python 3.7? Was that the one that made me continue using 3.6 well into its "security updates only" stage?
@mhm6421
@mhm6421 10 ай бұрын
They are basically copying TypeScript and changing the design a bit.
@DecimasoN
@DecimasoN 10 ай бұрын
3:14 you mention PEP 648 when it's PEP 684 :P
@fieldtm1able
@fieldtm1able 10 ай бұрын
When can we get 3.14thon?
@aka5
@aka5 10 ай бұрын
A lot of changes dedicated to typing for a dynamically typed language...
@JellyFoxYT
@JellyFoxYT 10 ай бұрын
I don't really understand the type params section. Can someone explain it?
@konpet4248
@konpet4248 10 ай бұрын
Python 3.7 is now deprecated, huh? Feels weird, since that's the version I started coding on. But ofc it needed to go eventually. Other than it having a special place in my heart, there's no point in holding onto it
@Impatient_Ape
@Impatient_Ape 10 ай бұрын
"...and then you have to learn about category theory..." 😆
@Kikujiro360
@Kikujiro360 10 ай бұрын
I hope they rename it pithon when it reaches 3.14
@danielschmider5069
@danielschmider5069 10 ай бұрын
3:13 its PEP six- eighty-four, not fourty-eight!
@secondengineer9814
@secondengineer9814 10 ай бұрын
It's wild how much static typing has been added to a dynamically typed language
@FrederikSchumacher
@FrederikSchumacher 10 ай бұрын
Fortunately, that stuff is still only "type annotations". Meaning, the interpreter, runtime and compiler doesn't do any checking beyond "must be valid Python expression". Which means you can do things like: def tricky_function(tricky_argument: "Beware of using dict[str, Movie] here, it breaks") -> "Mostly None, but List[Movie] on Sundays": pass And it's valid Python.
@carnap355
@carnap355 10 ай бұрын
What's "type variable"?
@marcinpohl3264
@marcinpohl3264 10 ай бұрын
What about Linux perf support? I'd love to see a good example of it
@therealjannis12
@therealjannis12 9 ай бұрын
Do they rename Python to PIthon at Version 3.14?
@Gallardo994
@Gallardo994 10 ай бұрын
Mod... Whiskey?
Modern Python logging
21:32
mCoding
Рет қаралды 179 М.
i'm so tired of talking about this..
10:00
Low Level Learning
Рет қаралды 27 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 46 МЛН
а ты любишь париться?
00:41
KATYA KLON LIFE
Рет қаралды 3,4 МЛН
Whoa
01:00
Justin Flom
Рет қаралды 17 МЛН
TypeScript Origins: The Documentary
1:21:36
OfferZen Origins
Рет қаралды 284 М.
Python Debugging (PyCharm + VS Code)
24:18
mCoding
Рет қаралды 37 М.
How Much FASTER Is Python 3.13 Without the GIL?
10:00
ArjanCodes
Рет қаралды 147 М.
Python itertools - The key to mastering iteration
20:03
mCoding
Рет қаралды 32 М.
What's new in Python 3.13?
5:08
Carberra
Рет қаралды 81 М.
Generics: The most intimidating TypeScript feature
18:19
Matt Pocock
Рет қаралды 172 М.
Unlocking your CPU cores in Python (multiprocessing)
12:16
mCoding
Рет қаралды 301 М.
Protocols vs ABCs in Python - When to Use Which One?
15:31
ArjanCodes
Рет қаралды 35 М.
Async for loops in Python
16:36
mCoding
Рет қаралды 61 М.
黑天使遇到什么了?#short #angel #clown
00:34
Super Beauty team
Рет қаралды 46 МЛН