You Are Going To Like These New Features In Python 3.11

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ส.ค. 2024
  • Python 3.11 is almost here! Not all of the changes are immediately noticeable when you look through the release notes. However, today I will cover 7 new Python 3.11 features that you are going to love because they'll make your life a lot easier.
    👉🏻 The code I worked on in this video is available here: github.com/ArjanCodes/2022-py...
    🚀 Next-Level Python Skillshare Class: skl.sh/3ZQkUEN
    👷 Join the FREE Code Diagnosis Workshop to help you review code more effectively using my 3-Factor Diagnosis Framework: www.arjancodes.com/diagnosis
    💻 ArjanCodes Blog: www.arjancodes.com/blog
    🎓 Courses:
    The Software Designer Mindset: www.arjancodes.com/mindset
    The Software Designer Mindset Team Packages: www.arjancodes.com/sas
    The Software Architect Mindset: Pre-register now! www.arjancodes.com/architect
    Next Level Python: Become a Python Expert: www.arjancodes.com/next-level...
    The 30-Day Design Challenge: www.arjancodes.com/30ddc
    🛒 GEAR & RECOMMENDED BOOKS: kit.co/arjancodes.
    👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel!
    💬 Discord: discord.arjan.codes
    🐦Twitter: / arjancodes
    🌍LinkedIn: / arjancodes
    🕵Facebook: / arjancodes
    📱Instagram: / arjancodes
    👀 Code reviewers:
    - Yoriz
    - Ryan Laursen
    - James Dooley
    - Dale Hagglund
    🎥 Video edited by Mark Bacskai: / bacskaimark
    🔖 Chapters:
    0:00 Intro
    1:07 Tomllib
    2:18 Exception notes
    3:21 Tracebacks are more precise
    3:57 New LiteralString type
    5:01 Self type
    6:41 StrEnum type
    7:40 Improved performance
    #arjancodes #softwaredesign #python
    DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!

ความคิดเห็น • 209

  • @ArjanCodes
    @ArjanCodes  9 หลายเดือนก่อน

    👷 Join the FREE Code Diagnosis Workshop to help you review code more effectively using my 3-Factor Diagnosis Framework: www.arjancodes.com/diagnosis

  • @geoffseyon3264
    @geoffseyon3264 ปีที่แล้ว +73

    I think the performance improvement is one of the most key benefits of Python version 3.11! I hope that this trend will continue in subsequent versions as people continue to compare python to more performant languages.

    • @PanduPoluan
      @PanduPoluan ปีที่แล้ว +2

      Microsoft has tasked -- and paid -- 2 Python Code Devs to speed up CPython. Mike Shannon and Guido van Rossum. And Mike outright stated that the target is 5x performance!!
      At such speed, the performance penalty of Python will be less and less important, and people will emphasize on Python's ease of use, or even the "compile-less" toolchain will be preferable!!
      And with a parallel effort to run Python in browsers (via Wasm), we might just be on the cusp of seeing Python as a first-class Front End language!

    • @JP-re3bc
      @JP-re3bc ปีที่แล้ว

      @@PanduPoluan CPython is not Python (anymore at least)

    • @PanduPoluan
      @PanduPoluan ปีที่แล้ว +3

      @@JP-re3bc The heck are you talking about?
      CPython is the reference implementation of Python, written in C.
      I think you're confusing it with Cython.

  • @equu497
    @equu497 ปีที่แล้ว +22

    Just found your channel earlier this week and I am impressed by the quality of your videos! Keep doing what you do sir.

  • @twentytwentyeight
    @twentytwentyeight ปีที่แล้ว +2

    I watched your video all the way through and sent it to my colleague who is learning python too, and wihtin ten minutes I also got an email reminding me you had a new video out! Thanks a bunch Arjan! The absolute ONLY youtuber I look froward to getting emails from

  • @MaycolTeles
    @MaycolTeles ปีที่แล้ว +16

    This new “Self” type is amazing! I had to explain the whole core of “__future__” and “annotations” for an intern a couple of days ago and I can’t even imagine how simple it would be with this type, even though what you said about classmethods are true

  • @superscatboy
    @superscatboy ปีที่แล้ว +2

    I haven't written any python since 2.4, but I watch this channel religiously to keep myself in the loop. One of these days I'll want to use python again and what I learn here is going to make the process of catching up much less painful :)

  • @martynhale4053
    @martynhale4053 ปีที่แล้ว

    Great video - I enjoy the content, you do a great job of it.

  • @aashayamballi
    @aashayamballi ปีที่แล้ว +8

    This speed improvement will definitely help in existing projects. (For example Django). Since classes variable initialisation all these being used extensively used in the existing frameworks and with this performance I believe definitely the frameworks performance is gonna improve too.. so for this reason I'm looking forward to use Python 3.11
    Thanks Arjan for this informative video. 🙏🏽

  • @ErhoSen
    @ErhoSen ปีที่แล้ว

    Thank you Arjan! Always promote your videos between colleges (win-win)

  • @RR-rd1yr
    @RR-rd1yr ปีที่แล้ว +2

    Thanks bro finally someone who isn't posting malware or fake stuff, you deserve my subscribe!

  • @szjtk
    @szjtk ปีที่แล้ว

    that was exactly what I needed , thank you so much

  • @BrianStDenis-pj1tq
    @BrianStDenis-pj1tq ปีที่แล้ว

    So good, thanks Arjan.

  • @Ponder_AI
    @Ponder_AI ปีที่แล้ว +1

    Looks great!

  • @marianarodriguez599
    @marianarodriguez599 ปีที่แล้ว

    Hey! Thanks so much for this video!

  • @thichuyen1597
    @thichuyen1597 ปีที่แล้ว

    Worked smoothly, tysm

  • @gustavomendez6279
    @gustavomendez6279 ปีที่แล้ว +1

    Concise and understandable information. Aesthetically pleasing video. Good audio. Man, where has this channel been? Subbed.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks for subbing! :)

  • @tadastadux
    @tadastadux ปีที่แล้ว

    I like your content and the jumper!

  • @transatlant1c
    @transatlant1c ปีที่แล้ว +5

    The first thing that sprang to mind re performance improvements is how that will eventually (hopefully) translate to lower bills for AWS lambda functions and equivalents, for those that make heavy use of python in that use case. Nice 👍

    • @idcarlos
      @idcarlos ปีที่แล้ว +3

      Right now only if you use docker containers. Python runtime is stuck at 3.9 for AWS Lambdas and 3.10 is one year old.

  • @michalkorsak9726
    @michalkorsak9726 ปีที่แล้ว

    Wow! it's Amazing I did it well ! Perfect work !

  • @hasanmahmud2016
    @hasanmahmud2016 ปีที่แล้ว

    Works good, tnx

  • @scraps7624
    @scraps7624 ปีที่แล้ว

    This is the top channel for anything python, great video as always

  • @anaselhassani2545
    @anaselhassani2545 ปีที่แล้ว

    THANK YOU SO MUCH FOR THIS VIDEO

  • @lorlgd
    @lorlgd ปีที่แล้ว

    I've been waiting for this version after Guido's presentation ( you can Google the presentation, I believe it's under his GH). I need to benchmark my scripts' performance and see the improvement. Thanks for sharing

  • @Darakon
    @Darakon ปีที่แล้ว

    Love your stuff dude. Thanks.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks, happy you’re enjoying the content!

  • @mentefria98
    @mentefria98 ปีที่แล้ว +3

    I love the way you explain things, very calmly and professionally, not as the nowadays kids that only know how to explain hello world with weird music in the background and make some shitty TikTok video.
    Thanks for being alive! Keep it going! You are doing a really good job.

  • @konstantinmykhailov6708
    @konstantinmykhailov6708 ปีที่แล้ว +47

    Great video! Could you please also cover the new asyncio TaskGroups and the GroupErrors with the except* syntax? Thanks!

    • @jorgesilva932
      @jorgesilva932 ปีที่แล้ว +3

      Great suggestion, I would also like to see a video about the new TaskGroups !

  • @lastk1ng201
    @lastk1ng201 ปีที่แล้ว

    That was great. Thank you.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks so much, glad the content is helpful!

  • @bartdebruijn4599
    @bartdebruijn4599 ปีที่แล้ว

    Good vid!

  • @amandubey5287
    @amandubey5287 ปีที่แล้ว

    This is just amazing I just updated my version and tested these what you just showed, Thanks

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks Aman, Glad it was helpful.

  • @HeadInstead
    @HeadInstead ปีที่แล้ว

    great video Arjan.
    you might want to add the link to the chess roast video 5:55

  • @edwinolvera2731
    @edwinolvera2731 ปีที่แล้ว

    Thanks so much

  • @darrylbaker5271
    @darrylbaker5271 ปีที่แล้ว

    Clearly explained, I understood, and I'm not a Python user but will be soon

  • @chrisfahie2767
    @chrisfahie2767 ปีที่แล้ว

    Thanks it helped me install it

  • @barbaralemagac2333
    @barbaralemagac2333 ปีที่แล้ว

    thanks helpful vid

  • @Mr1995Musicman
    @Mr1995Musicman ปีที่แล้ว +2

    Oh, I also use the StrEnum pattern myself as well, but I'm never quite satisfied that I'm not screwing it up somehow. Great to see that built in

    • @astronemir
      @astronemir ปีที่แล้ว +1

      I always use this

  • @havenisse2009
    @havenisse2009 ปีที่แล้ว +8

    So we now know the next versions of python will be 95, 98 and se.

  • @Blooddarkstar
    @Blooddarkstar ปีที่แล้ว

    I find your videos extremely helpful and well executed. You should do a full coursera / udemy course on "coding well". By that I mean content focusing on the design of code and the aspect of problem solving before you even write a line of code. You do this in the videos here on youtube as well, but a full-blown structured course would be awesome. I have seen so many Intro to Programming / python courses which do not focus on the importance of structuring your code.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Glad you like the content! There is a course actually if you’re interested: www.arjancodes.com/mindset.

  • @mcfahr3655
    @mcfahr3655 ปีที่แล้ว

    Thank you!

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks so much, glad the content is helpful!

  • @ErikS-
    @ErikS- ปีที่แล้ว +2

    9:18 - The home of both Arjan and off course Guido, the creator of Python.
    Next, we will see Arjan start showing us "frikadel" and "kroketten".

  • @matthewlandry1352
    @matthewlandry1352 ปีที่แล้ว

    Nice video so I clicked subscribe 🎉

  • @Rebeljah
    @Rebeljah ปีที่แล้ว +1

    Almost here!

  • @haleynaga5671
    @haleynaga5671 ปีที่แล้ว

    i like your thumbnail of actually excited for something whereas others people's thumbnail goes something like "you should not be developer" or "you maybe not a data science to be at all" so its good to see fresh new face

  • @pleggli
    @pleggli ปีที่แล้ว +1

    I so much wished that the error positions in tracebacks somehow would have used the more common line:column formatting that most compilers use. On scale the verbose 2 extra lines just adds unnecessary cost to logging unless you disable it.

  • @Rana-yc6yt
    @Rana-yc6yt ปีที่แล้ว

    You are awesome 👌

  • @mahdi7d1rostami
    @mahdi7d1rostami ปีที่แล้ว

    taking enjoyment in writing complicated one-liners just for fun I didn't had any way of debugging or figuring out how can I fix them when they didn't work. Now with new trackbacks it would be easier.

  • @AbdulBasit-ib6by
    @AbdulBasit-ib6by ปีที่แล้ว

    I love the feature in 3.11 where its give you precisely where the the actually error.

  • @akshattamrakar9071
    @akshattamrakar9071 ปีที่แล้ว

    Those performance improvements are crisp

  • @Gummibandet1
    @Gummibandet1 ปีที่แล้ว +4

    You coulve showed how the add exception notes looks in the trace when running it

    •  ปีที่แล้ว

      Guessing they're not showing at all. You can probably print then yourself though.

  • @erastfandorin279
    @erastfandorin279 ปีที่แล้ว +21

    Hey Arjan, I think that in your first example of performance boost in python3.11 you are misinterpreting actual speed boost to 50% as it usually happens with this counter intuitive thing.
    TL;DR u have 0.095 sec/code and 0.053 sec/code. Then in 1 sec you achieve about ~10 and ~18 codes done which actually is an 80-90% speed boost.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว +4

      You’re right - that’s a good point. And it demonstrates the performance improvements even more clearly.

    • @nivimani
      @nivimani ปีที่แล้ว +2

      this is subjective - the new performance can be seen as 50% faster in comparison to the old performance, but the old performance can be seen as 90% slower in comparison to the new performance.

    • @russianbotfarm3036
      @russianbotfarm3036 ปีที่แล้ว +1

      @@nivimani But that’s not subjective.

    • @nivimani
      @nivimani ปีที่แล้ว

      @@russianbotfarm3036 you're right. i meant something like, it depends on someone's preferred point of view.

  • @astronemir
    @astronemir ปีที่แล้ว

    Can you do a video on Type annotations for Pandas and the new 3.11 Generics changes?

  • @CynicAtLarge
    @CynicAtLarge ปีที่แล้ว

    With toml support do your recommend using this instead of hydra with yaml files for configuration?

  • @rockNbrain
    @rockNbrain ปีที่แล้ว

    WAITING FOR 3.12 VERSION, TKS!

  • @udianilbey
    @udianilbey ปีที่แล้ว

    Self type isn't introduced for renaming, it's introduced to type annotate methods of inherited classes.

  • @astronemir
    @astronemir ปีที่แล้ว

    Almost here 🎉

  • @StickOnLSD
    @StickOnLSD ปีที่แล้ว

    Hey Arjan, can you please make a tutorial about logging? thanks!

  • @jahshuah
    @jahshuah ปีที่แล้ว

    Totally not related to Python 3.11, but I love that sweatshirt-where’d you pick it up?

  • @chesshooligan1282
    @chesshooligan1282 ปีที่แล้ว +2

    When the execution time halves, it means the speed has doubled. That's a 100% performance improvement, not a 50% performance improvement.

  • @abdelghafourfid8216
    @abdelghafourfid8216 ปีที่แล้ว

    Do Self type also dynamicaly change if I use a subclass ?

  • @Casimistico
    @Casimistico ปีที่แล้ว

    Best tutorials ever

  • @willemvdk4886
    @willemvdk4886 ปีที่แล้ว +2

    Somehow "version 3.11" has a very nostalgic ring to it.

    • @YourCRTube
      @YourCRTube ปีที่แล้ว

      Only if you are old

  • @incremental_failure
    @incremental_failure ปีที่แล้ว +1

    3.10 was really cool feature wise but 3.11 doesn't add anything I depend on. The speed improvements are awesome though, they're going in the right direction.

  • @nck-d
    @nck-d ปีที่แล้ว

    Thanks

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thank you so much, glad you enjoyed the video!

  • @MichaelRonnfeldt
    @MichaelRonnfeldt ปีที่แล้ว

    Those are some nice performance improvements.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Thanks Michael, happy you’re enjoying the content!

  • @russianbotfarm3036
    @russianbotfarm3036 ปีที่แล้ว

    > StrEnum saves typing
    > proceeds to type about the same as the old names
    = auto() is ugly boilerplate, but it does reduce the chance you’ll misspell the particular enums. They should have done it as a context, EnumDefiner or something.

  • @tomlightfoot6304
    @tomlightfoot6304 ปีที่แล้ว

    In his piece class, what does the colon do in x: int or color: Color = Color.None? Ive never seen that before.

  • @mayorc
    @mayorc ปีที่แล้ว

    At 5:25 how did you add those unicode symbols easily?

  • @benc7910
    @benc7910 ปีที่แล้ว

    Which color theme is this in ?

  • @Yotanido
    @Yotanido ปีที่แล้ว +1

    I see a lot of influences from rust in this. I like it a lot.
    Soooo... algebraic data types when? It's honestly the feature I miss by far the most in python.

  • @dvdspndl
    @dvdspndl ปีที่แล้ว

    Awesome video, thank you.
    The example of faster 3.11 that demonstrates it using class get-set-delete in 8:25 is about the same speed as what you'd gain with __slots__ on 3.10, and it looks like slots are no longer faster in 3.11. Do you know what happened there?

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว +1

      Thanks David! When I run a test with Python 3.11 and compare slots vs no slots, I still get a 20% speed improvement when using slots (comparing the median execution time). So it seems that even in Python 3.11, using slots is still quite a bit faster.

    • @dvdspndl
      @dvdspndl ปีที่แล้ว

      @@ArjanCodes Thank you for the reply. Interesting, I checked again and you are probably right, there's still a difference, although it seems much smaller than what I had in python3.10.

  • @frozeneye100
    @frozeneye100 ปีที่แล้ว

    Lol. Nice feature of python. I am still trying to learn and just think f strings are awesome. Just think I am wrapping my head around stuff and then the f bomb ohh SQL injection so we do different now. I will not french "f string" but yeah f bombs is like a pun intended. Nice video. But yeah, programming languages like Linux is just a rabbit hole without end. Poor me being newb. But will get there. But as always. Nice good video with not all info but it does allow good topics for research. That I think is a very good point. Not giving do like this but making clear here is how you can. And that is worth a lot. That is key to education I think. Not giving answers but give enough in way to make it useful but also there is work to be done and learn

  • @MrGeometres
    @MrGeometres ปีที่แล้ว

    Almost here, but as per tradition you'll have to wait 6 months until all the packages you need support it.

  • @-mwolf
    @-mwolf ปีที่แล้ว +1

    bruh haha 3.11 is so nice
    I remember using hacks to implement all these things like StrEnum and so on myself.
    Also i think with 3.11 there should be shape hinting for np arrays or tensors which is a game changer in ds / ml.

    • @rogertunnell5764
      @rogertunnell5764 ปีที่แล้ว

      I saw a proposal for this the other day, though I'm not sure if it made it into 3.11

  • @carlosrivadulla8903
    @carlosrivadulla8903 ปีที่แล้ว

    what do u think of carbon?

  • @adrienc8716
    @adrienc8716 ปีที่แล้ว

    Is it possible to read an xml file with tomlib ?

  • @__gavin__
    @__gavin__ ปีที่แล้ว

    9:00 actually that would be nearly a 100% improvement (half the time is twice as fast).

  • @StalkedByLosers
    @StalkedByLosers ปีที่แล้ว

    What is the benefit of toml ove ini files? The structure looks the same. Just import configparser....

  • @edgeeffect
    @edgeeffect ปีที่แล้ว

    It's cool to get a definitively correct pronunciation for "Edsger Dijkstra" after all these years.

  • @videosgx3548
    @videosgx3548 ปีที่แล้ว

    now i am in a good mood

  • @snoopyjc
    @snoopyjc ปีที่แล้ว

    I love how your outfit spells “11” :-)

  • @pillmuncher67
    @pillmuncher67 ปีที่แล้ว

    I'm so glad they finally put Tail Call Elimination in CPython!... Oh....wait...

  • @ingframin
    @ingframin ปีที่แล้ว

    Honestly, I cannot wait to get this new version.

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว

      Only a few days now.

    • @ewerybody
      @ewerybody ปีที่แล้ว

      honestly? release candidate 2 is available for download on the official website

  • @janetdashevsky495
    @janetdashevsky495 ปีที่แล้ว

    Hi, Can you please share the source of the hoodie? My husband really wants one :)

  • @TomTrval
    @TomTrval ปีที่แล้ว

    Yes yes self typeeee

  • @avalagum7957
    @avalagum7957 ปีที่แล้ว

    Is it possible to have a portable Python, i.e. no need to install, just download 1 single file and put it in the PATH?

  • @theultimatereductionist7592
    @theultimatereductionist7592 ปีที่แล้ว

    the reason I hate hate hate computer programming is that absolutely nothing any of millions of online tutorials or videos can help me do the specific thing *I* need the computer to do: computer differential algebra.

  • @daverangie
    @daverangie ปีที่แล้ว

    What would performance it be like compared to 3.7

  • @rusektor
    @rusektor ปีที่แล้ว

    LiteralString didn't work for me. I tried the example from documentation - and it didn't work.

  • @PanduPoluan
    @PanduPoluan ปีที่แล้ว +1

    Dijkstra, Guido, now Arjan. The Dutch gave many great things, and so I'm saying "hello" from (formerly) Pays Kolonie 😄
    Anyways, 3.11 performance improvement is really amazing in asyncio! I had script I originally wrote in 3.10, it runs a bit faster in PyPy, but MUCH faster in 3.11! So much so that I broke my rule of not using anything ".0" for production 😜
    Edit: Maybe not asyncio itself per se, but every asyncio task I queued will end up instantiating a class, so I believe that's where 3.11's speedup benefitted me greatly.

  •  ปีที่แล้ว

    Ive always wondered why exceptions in python don't have more info. Coming from the java world it felt a bit weak.

    • @rogertunnell5764
      @rogertunnell5764 ปีที่แล้ว

      Interesting take. I've always found exceptions in Java to be far more cryptic. Granted most of my work in Java has been heavily dependent on libraries, so maybe the library authors are more to blame than the exception handling.

  • @JP-re3bc
    @JP-re3bc ปีที่แล้ว

    Does it remain slooooow? Most of this new bloatware will only make it even slower.

  • @thisoldproperty
    @thisoldproperty ปีที่แล้ว

    I implement Python in Azure Functions, which maxes out currently at 3.9 :(

  • @gnitsaf
    @gnitsaf ปีที่แล้ว

    toml config files... so like rust? That's pretty sweet

  • @parkercrofts6210
    @parkercrofts6210 ปีที่แล้ว

    ur a fcking legend dude honestly

  • @hmdhossam2801
    @hmdhossam2801 ปีที่แล้ว

    Dear Michael, it's you that make register for yo

  • @MartinMarcher
    @MartinMarcher ปีที่แล้ว

    I swear…if we get “import strict” for types I’ll start Perl 😂

  • @GregorioRosson
    @GregorioRosson ปีที่แล้ว

    gave a like for the exceptional pun

  • @udovyk
    @udovyk ปีที่แล้ว +2

    Python 3.11 almost here and AWS Lambda still didn't implement v3.10 runtime :)

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว +3

      They might be stuck on the current stable version of Debian, which has Python 3.9.

  • @AlexGb007
    @AlexGb007 ปีที่แล้ว

    So all I have to do to becoming a great computer scientist is moving to the Netherlands! Got it!

    • @ArjanCodes
      @ArjanCodes  ปีที่แล้ว +1

      Exactly! Though the problem is that once you're here, you'll be surrounded by great computer scientists who are going to continuously point out any minor thing you're doing wrong. It's like real-life Reddit :).

    • @AlexGb007
      @AlexGb007 ปีที่แล้ว

      @@ArjanCodes 🤣🤣🤣. I love your sense of humor 😂😂

  • @jccorman5848
    @jccorman5848 ปีที่แล้ว

    I find your content quite engaging, but it is way too advanced for me. I am new to Python and don't come from a CS background. What book or resources would you consider to be to your standards, to get a newbie like me in the correct path for solid python coding. (I don't think the Python documentation is really for beginners)

  • @frankieepurr
    @frankieepurr ปีที่แล้ว

    Still using python 3.4 at school