ALL of Python 3.13's MAJOR typing changes

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ม.ค. 2025

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

  • @renren_does_programming
    @renren_does_programming 3 หลายเดือนก่อน +30

    Nice, one step closer to pi-thon

    • @PennyEvolus
      @PennyEvolus 3 หลายเดือนก่อน

      Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan Shikanokonoko koshitantan

  • @EngineerNick
    @EngineerNick 3 หลายเดือนก่อน +2

    Thankyou this was a great summary and demo :)

  • @maleldil1
    @maleldil1 3 หลายเดือนก่อน +12

    Why do you use the old generics syntax for these examples? IMO, it doesn't much sense to use the old syntax when the new one is available. I understand using it for more general videos, so they apply to a wider public, but not here. Regardless, I'd appreciate it if you could show both versions anyway.
    Anyway, great video. Hopefully pyright implements the new typing stuff soon.

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +4

      Largely because the PEP uses the old syntax, and neither Mypy or Pyright was particularly happy using the new syntax with defaults, so I decided to go with what's definitely known to work rather than complicate it. Glad you enjoyed the video though!

    • @Heavy_Lvy
      @Heavy_Lvy 3 หลายเดือนก่อน +1

      @@Carberra i hate the old syntax😭😭

  • @Heavy_Lvy
    @Heavy_Lvy 3 หลายเดือนก่อน +3

    7:16 probably the extension is using a older version of pyright or mypy. The extension won't use the pyright/mypy version installed on your environment.

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +1

      I was using the latest version of Pyright (at time of recording) from the terminal, not an extension. If Pyright doesn't support something, it's pretty much a dead cert Mypy doesn't support it either.

    • @Heavy_Lvy
      @Heavy_Lvy 3 หลายเดือนก่อน

      @@Carberra hmm thats strange then, it was working fine for me just not default TypeVars with 3.13 syntax.🤷‍♂🤷‍♂🤷‍♂🤷‍♂

  • @fmitchell238a
    @fmitchell238a 3 หลายเดือนก่อน

    Thanks for this. I'm just now catching up on 3.13's features.
    A video on support for Protocols would be appreciated. My statically typed brain still can't quite fit itself around Python's protocols using duck typing, and compile-time or run-time predicates verifying that a class conforms to a Protocol would make using Protocols feel like black magic (or pure superstition).

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +4

      Glad you enjoyed it! Protocols is actually a topic I've been meaning to cover for a while, so I'll bump that up the queue! The runtime checkable thing is a pretty nice feature, so I'll make sure to cover that as well.

    • @marckiezeender
      @marckiezeender 3 หลายเดือนก่อน

      Protocols are basically just interfaces but without explicitly implementing them.

    • @jimhrelb2135
      @jimhrelb2135 3 หลายเดือนก่อน

      I use Protocols to enforce kwargs types, so not just using Callable to enforce vargs

  • @murphygreen8484
    @murphygreen8484 3 หลายเดือนก่อน

    What's the benefits of ReadOnly over Final?

    • @Carberra
      @Carberra  3 หลายเดือนก่อน

      Can you use Final in TypedDicts? If so, I'm honestly not sure!

    • @murphygreen8484
      @murphygreen8484 3 หลายเดือนก่อน

      @@Carberra oh I'm not sure, it's part of the typing library though!
      Speaking of typing things - why is typing a openpyxl object such a nightmare? I can't get PyCharm to recognize it

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +1

      I believe Openpyxl isn't typed. If it has a stubs package, might be a case of installing that and getting PyCharm to recognise it? Though this isn't the first time I've heard about someone having trouble _this week_, so idk if something's going on.

  • @chrism6880
    @chrism6880 3 หลายเดือนก่อน +1

    Is it possible to back port the new repl to use it with older python versions?

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +3

      Not to my knowledge. You can use the third-party IPython REPL in older versions though, which is different but very nice to use.

  • @solojazzz
    @solojazzz 3 หลายเดือนก่อน

    wait I thought that python 3.13 was about using 'type' as a keyword instead of TypeVar

    • @Carberra
      @Carberra  3 หลายเดือนก่อน +2

      3.12 introduced the type keyword as an alternative to TypeAlias. It also introduced an alternative syntax for TypeVars (though I haven't used that here as it's not fully supported by type checkers).

    • @solojazzz
      @solojazzz 3 หลายเดือนก่อน

      @@Carberra yeah i was with the idea it's the preferred way over TypeVar now.
      type T = ContextType

    • @solojazzz
      @solojazzz 3 หลายเดือนก่อน

      it seems a bit more pythonic that TypeVar