Structural Pattern Matching - Exciting New Python Feature (3.10)

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ค. 2024
  • Welcome back to another TH-cam video! In this video, I'm going to be showing a new feature coming to Python version 3.10. This feature is Structural Pattern Matching, this is similar to a switch statement in other programming languages but much stronger.
    💻 AlgoExpert is the coding interview prep platform that I used to ace my Microsoft and Shopify interviews. Check it out and get a discount on the platform using the code "techwithtim" algoexpert.io/techwithtim
    📄 Resources 📄
    Python 3.10 Beta Download: www.python.org/downloads/rele...
    Python 3.10 New Features: docs.python.org/3.10/whatsnew...
    ⭐️ Timestamps ⭐️
    00:00 | Python 3.10
    02:18 | Structural Pattern Matching
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    💰 Courses & Merch 💰
    💻 The Fundamentals of Programming w/ Python: tech-with-tim.teachable.com/p...
    👕 Merchandise: teespring.com/stores/tech-wit...
    🔗 Social Medias 🔗
    📸 Instagram: / tech_with_tim
    📱 Twitter: / techwithtimm
    ⭐ Discord: / discord
    📝 LinkedIn: / tim-ruscica-82631b179
    🌎 Website: techwithtim.net
    📂 GitHub: github.com/techwithtim
    🔊 Podcast: anchor.fm/tech-with-tim
    🎬 My TH-cam Gear 🎬
    🎥 Main Camera (EOS Canon 90D): amzn.to/3cY23y9
    🎥 Secondary Camera (Panasonic Lumix G7): amzn.to/3fl2iEV
    📹 Main Lens (EFS 24mm f/2.8): amzn.to/2Yuol5r
    🕹 Tripod: amzn.to/3hpSprv
    🎤 Main Microphone (Rode NT1): amzn.to/2HrZxXc
    🎤 Secondary Microphone (Synco Wireless Lapel System): amzn.to/3e07Swl
    🎤 Third Microphone (Rode NTG4+): amzn.to/3oi0v8Z
    ☀️ Lights: amzn.to/2ApeiXr
    ⌨ Keyboard (Daskeyboard 4Q): amzn.to/2YpN5vm
    🖱 Mouse (Logitech MX Master): amzn.to/2HsmRDN
    📸 Webcam (Logitech 1080p Pro): amzn.to/2B2IXcQ
    📢 Speaker (Beats Pill): amzn.to/2XYc5ef
    🎧 Headphones (Bose Quiet Comfort 35): amzn.to/2MWbl3e
    🌞 Lamp (BenQ E-reading Lamp): amzn.to/3e0UCr8
    🌞 Secondary Lamp (BenQ Screenbar Plus): amzn.to/30Dtafi
    💻 Monitor (BenQ EX2780Q): amzn.to/2HsmUPZ
    💻 Monitor (LG Ultrawide 34WN750): amzn.to/3dSD7tS
    🎙 Mic Boom Arm (Rode PSA 1): amzn.to/30EZw9m
    🎚 Audio Interface (Focusrite Scarlet 4i4): amzn.to/2TjXsih
    💸 Donations 💸
    💵 One-Time Donations: www.paypal.com/donate?hosted_...
    💰 Patreon: / techwithtim
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ⭐️ Tags ⭐️
    - Tech With Tim
    - Python Version 3.10
    - Python
    - New Feature
    - Structural Pattern Matching
    - Switch
    ⭐️ Hashtags ⭐️
    #TechWithTim #Python

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

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

    I think the case(0, y) makes horizontal line with y provided, not a vertical, and vice versa.

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

      Good catch!

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

      I think a better fix to this bug is to say that (0, y) is a vertical-intercept (or y-intercept) and (x, 0) is a horizontal-intercept (or x-intercept). This is because for a line to be drawn, two points on said line are needed. Since we are only analysing one point at a time, it is most accurate to say that it is an intercept of either axes, provided that either x == 0 or y == 0.

    • @yamom...5918
      @yamom...5918 2 ปีที่แล้ว

      algebra

    • @donh9135
      @donh9135 2 ปีที่แล้ว

      Which axis is the x-axis? Horizontal or vertical?

    • @yamom...5918
      @yamom...5918 2 ปีที่แล้ว

      @@donh9135 horizontal

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

    Finally it would be easy and less chaotic to make command line programs.

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

    I was fascinated that Python avoided a switch statement and now I see this and think, "It was worth the wait". This is great and extremely flexible.

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

    Finally! I've been missing switch statements in Python

    • @Ollital
      @Ollital 2 ปีที่แล้ว

      me2. I can't wait to update the if-elif cascades to match.

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

    MISTAKE IN THIS VIDEO
    You don't NEED to use an underscore. You can AND SHOULD use any valid variable name to capture the value for later use, such as if you want to include the value in a raised error.
    The reason the underscore is used is that sometimes you will not need to access that variable after capturing it and in python tools (flake8, pylint, pylance, mypy), the underscore doesn't raise a warning if the variable is never accessed as any other variable name will.

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

      As in, when none of the variables are used again in case _ , x means _ and x can be the same?

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

      Use an underscore if you DO NOT need to access the matched object in the case code block. Otherwise use a meaningfully-named variable to access the value inside the case code block.

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

      You only should use a variable if you need to use the value, otherwise use an underscore.

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

    Congrats python for improving on an old concept in a new and innovative way! It was worth the wait for the switch statement to see this!

  • @dawidstaniek6234
    @dawidstaniek6234 2 ปีที่แล้ว

    Hello everybody and welcome ... Your intro is the best! And content too :)

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

    Nice video, can I use the "match" & "case" statements at one line like the "if" one, also I am not sure why did they add these while we can simply do almost most of it using the "if" statement and get the same result ..

  • @MadPonyInteractive
    @MadPonyInteractive 2 ปีที่แล้ว

    I love the way you explain, thank you.
    This is really powerful stuff specially when we integrate *args and **kwargs, def gonna use the heck out of it

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

    ohh What a nice video it is! Thanks for every information. match and switch statements are more useful than if and else. We can already use these instead of those and it prevent to repeat the same things. Now we just need to use one of them(match and switch) and It is the easier way to make code in Python in my opinion.

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

    In the example where you used case (x, y) if x == y:
    couldn’t you have done case (x, x)?
    i think that works in pattern matchers such as ocaml’s one, but not sure about this one!
    thank tou

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

    Thanks Tim really helpful 👍 🙏

  • @rice5817
    @rice5817 2 ปีที่แล้ว

    I have to say that I wasn't sure that I expected it to be anything hype, but damn - I will probably upgrade right away just to get this feature :D

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

    basically an alternative to the if,elif and else statement?

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

    as a java programmer that uses switch statements all the time. i am very excited.

  • @georgel9592
    @georgel9592 2 ปีที่แล้ว

    Could you please make an in depth tutorial on how to make a leaky bucket in python? I look at source code for other people’s, but I can’t understand it. I want to make a rate limiter for my API

  • @steventucker3149
    @steventucker3149 2 ปีที่แล้ว

    This is fantastic. I'm now very excited for 3.10. But ... as you don't put break in, I'm guessing there is no way to fall through? Perhaps with pattern matching it's not really necessary to fall through. Hmmm, need to spend some time with this. Great video!!

  • @octavsteaua2000
    @octavsteaua2000 2 ปีที่แล้ว

    What text editor are you using?

  • @carlosmspk
    @carlosmspk 2 ปีที่แล้ว

    Is there no way to make all cases get checked? The equivalent of turning each match from an "elif" to a "if"

  • @aledupapiecze
    @aledupapiecze 2 ปีที่แล้ว

    Your example_two program doesn't work properly. It would print valid coords for input like ("a", "b")

  • @ultrasacu4962
    @ultrasacu4962 2 ปีที่แล้ว

    What keyboard do you use now?

  • @daverei1211
    @daverei1211 2 ปีที่แล้ว

    Thanks Tim. Nice :-)

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

    Just a few hours ago I finished all the series and then there were none left and a few hours later there it is! Thankyou so much Tim!

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

    Cool features , python💪💥💥...

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

    I've just started to learn JavaScript and was wondering why python did not have a switch statement... amazing video/explanation, thank you!

    • @TechWithVince
      @TechWithVince 2 ปีที่แล้ว

      it's not switch statement, it's pattern matching, it used a lot in functional style programming.
      Is that good for python? I don't think so, it just add another layer of complexity but the community that run the language don't care about that anymore...

    • @ericks4774
      @ericks4774 2 ปีที่แล้ว

      @@TechWithVince I don't see the wrong there, why is bad to add an optional feature that makes the language more completed

    • @TechWithVince
      @TechWithVince 2 ปีที่แล้ว

      @@ericks4774 It will train people to use recursion, because pattern matching is usually used with recursion and python is very slow at recursion.
      it's add a new way of doing the exact same thing that break python phisolophy to keep things simple.
      Otherwise I really like the feature

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

    union and algebraic data types are cool as hell

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

    Great job Tim!
    it's just like He Did developed Python 3.10 version

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

    This is awesome !!

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

    The one feature I thought python lacked and now we have it. I've not been this excited about a new version of a language since VB4 came out.
    Honestly I'm hyped over the new "match" statement.

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

    What's the difference between the match: case statement and simple if, if else??

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

      prolly, to be like other programming languages lmao
      but tbh it looks cleaner like this ig!

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

    Nice, feels like Elixir

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

    This is "select case" like in other languages, but maybe more powerful.

  • @pic01
    @pic01 2 ปีที่แล้ว

    Yeah I like this. thanks tim

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

    Will python 4 be a thing?

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

      I dont think in near future because 3.10 is valid until 2025 and 3.11 is in development already.

    • @DaniloSilva-pl3sq
      @DaniloSilva-pl3sq 2 ปีที่แล้ว +1

      Guido van Rossum said that if there ever will be Python 4, the transition from 3 to 4 is gonna be smoother than that of 2 to 3

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

      Sure, there would be a python 4, but we would have to wait for that.

    • @onlyforscience8255
      @onlyforscience8255 2 ปีที่แล้ว

      @@GainTheReason No I think they will release a new version of Python but It is enough up to 2022 or 2023.

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

      I hope Python 3.15 will be Python 4 to maintain the row of natural constants found in the last releases a python version.
      Golden ratio: 1.6.1
      e: 2.7.18
      pi: 3.14.x

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

    Your awesome man. Keep the good work up

  • @zmitiatef5188
    @zmitiatef5188 2 ปีที่แล้ว

    You're the best, can u make an angular course ! 😘

  • @gameryo3691
    @gameryo3691 2 ปีที่แล้ว

    You will never gonna give you up!

  • @mohammadfoadtavakoli7118
    @mohammadfoadtavakoli7118 2 ปีที่แล้ว

    Hi Tim. Live the videos

  • @qwxdw_69
    @qwxdw_69 2 ปีที่แล้ว

    what s the app he s editing in ?

  • @fackarov9412
    @fackarov9412 2 ปีที่แล้ว

    what about cases without "break"?

  • @GlanceOnline
    @GlanceOnline 2 ปีที่แล้ว

    That's sick !

  • @Laszer271
    @Laszer271 2 ปีที่แล้ว

    Reminds me of how you code in Prolog.

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

    Wile it’s always been possible to create match statement equivalents, a real switch/case mechanism is something Python has been lacking. Considering how many other features it has, it is strange that it’s taken this long to add it to the language

    • @willful759
      @willful759 2 ปีที่แล้ว

      I read somewhere that this has to do with the python philosophy, it's not that they can't, it wasn't considered necesary since if elif else does roughly the same thing, however pattern matching imo is way cleaner and I'm happy to see it being added, also the whole "doesn't fit the python philosophy" I just read it somewhere, I have 0 trustable sources so I would appreciate it if someone proves/disproves me

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

    feels like Haskell

  • @jedymatt
    @jedymatt 2 ปีที่แล้ว

    Can *a be replaced by *_ ?

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

    The underscore is just convention to say that you don’t care about the value of a variable.

  • @mohammadraufzahed
    @mohammadraufzahed 2 ปีที่แล้ว

    Awesome

  • @sathianarayananalagesan6480
    @sathianarayananalagesan6480 2 ปีที่แล้ว

    Hey Tim put python series for socket programming
    I will waiting for that bro

  • @enriquepenanieto9784
    @enriquepenanieto9784 2 ปีที่แล้ว

    Please make a flask-react project!

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

    I think this is the first time you are adding background music to a video...

  • @Bl0xxy
    @Bl0xxy 2 ปีที่แล้ว

    Why not just use if and elif?

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

    I feel like this would greatly simplify writing an interpreter or compiler and pretty much remove the need for regex. Can match statements be nested?
    Edit: yes they can!

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

    wow this is so powerful !

  • @felixzeller5641
    @felixzeller5641 2 ปีที่แล้ว

    Why dont you use pycharm anymore?

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

    What if I have a variable named _ ?

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

      variables get overwritten...
      you could also ask: "what if i have a variable x?"

  • @dillonbarnes232
    @dillonbarnes232 2 ปีที่แล้ว

    Much easier way to create voice assistants!

  • @ibrahim47
    @ibrahim47 2 ปีที่แล้ว

    It's nice except its still a statement not an expression, C# got it right, Scala got it right, see how pattern matching works in them.

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

    Much awaited feature in python !

  • @GodModeMaker
    @GodModeMaker 2 ปีที่แล้ว

    This looks a lot useful than it sounds. It'd save me from those pesky if elifs xD

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

    I personally wouldn't call it powerful because (at least for the examples you brought up) we do everything with if statements without increasing line count or unreadability too much :)
    There's probably a case where the if statement would take 10 lines and this one 2, but that's highly complex code anyway I guess, so it doesn't matter that much :)

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

    I’m a regular viewer of this channel. Didn’t expect to be the first to post a comment. Great tutorial s always!

  • @mohamedchekhab276
    @mohamedchekhab276 2 ปีที่แล้ว

    Please make a course about python in cyber security and ethical hacking 🥀🙏

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

    I am still busy in building my first calculator in python (I learnt the basics around 2 months back)

    • @electricz3045
      @electricz3045 2 ปีที่แล้ว

      lol you can just use the math symbols on integers:
      fn = input("Enter the first number: ")
      sn = input("Enter the second number: ")
      result = fn + sn
      print(f"The Result is: {result}")

    • @cozycode8586
      @cozycode8586 2 ปีที่แล้ว

      ​@@electricz3045 What if he/she wants to have an input like "1+2"? Then the project becomes more complex.

    • @electricz3045
      @electricz3045 2 ปีที่แล้ว

      @@cozycode8586 no? You run the script and then input the numbers you want to calculate

    • @cozycode8586
      @cozycode8586 2 ปีที่แล้ว

      @@electricz3045 I mean rather than having two inputs and a hardcoded "+" you simply type "1+2" in a single input statement. And don't forget other operations and the order of operation. For example: "2+4*5+(4/2)". The output should be 24.

    • @cozycode8586
      @cozycode8586 2 ปีที่แล้ว

      @sa9097 Yeah I mean you could do that, but still. Doesn't that remove the whole meaning of the project. And what if he/she wants to type X instead of *?(You could of course just do .replace("X", "*")) I think you get my point it is a good/difficult project for beginners.

  • @sebastian-yellowbunny2746
    @sebastian-yellowbunny2746 2 ปีที่แล้ว

    Similar to rust match statement

  • @NB-ph6cv
    @NB-ph6cv 2 ปีที่แล้ว +1

    or it can be written with if statement like a normal programmer :D

  • @shrikantdhayje3490
    @shrikantdhayje3490 2 ปีที่แล้ว

    But I Thought Adding Tags In Description Is Banned In TH-cam

  • @joelimbergamo639
    @joelimbergamo639 2 ปีที่แล้ว

    I normally agree with the python org but I really don't like how this writes. But even if it's ugly it's actually really usefull

  • @nicolasa.bermellferrer8025
    @nicolasa.bermellferrer8025 2 ปีที่แล้ว

    It feels like injecting some Haskell into python OwO

  • @parthkabra4968
    @parthkabra4968 2 ปีที่แล้ว

    It would be great if they make it fast

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

    Please make a video on face recognition!🧡💛❤💚💙💜🤎🥺

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

      check out his OpenCV tutorials the last one covers face recognition

    • @mathewsjoby6455
      @mathewsjoby6455 2 ปีที่แล้ว

      @@simonrobertgreenwoodThankyou so much bro! you're awesome😍. Thankyou so much for the help

    • @simonrobertgreenwood
      @simonrobertgreenwood 2 ปีที่แล้ว

      @@mathewsjoby6455 no problem :)

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

    Why not just regex?

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

      regex only matches strings. This can match a lot more python objects

    • @RyanKOnk
      @RyanKOnk 2 ปีที่แล้ว

      @@dqalombardi hmm you are right

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

    Hey try to add some smile to that face!

  • @edelinealexandre
    @edelinealexandre 2 ปีที่แล้ว

    OCML *intensifies*

  • @wege8409
    @wege8409 2 ปีที่แล้ว

    Insert YandareDev reference here

  • @terryr5713
    @terryr5713 2 ปีที่แล้ว

    Tim I am planning to get a law degree, can I combine it with computer science and cyber security!? Also I don't know any programming language

  • @cartersherman925
    @cartersherman925 2 ปีที่แล้ว

    Jump to 2:20

  • @trevormckellen5613
    @trevormckellen5613 2 ปีที่แล้ว

    recently i realized i've learned alot from Tim but wasn't subscribed. I immediatly did

    • @trevormckellen5613
      @trevormckellen5613 2 ปีที่แล้ว

      I came from zero to...i am pretty good right now. Coming from a third world country, the programming taught in school is just so bad(sorry). I made my school projects from what I'd learned from you. Thank you so much. Definitely told my friends about this channel

    • @Gigusx
      @Gigusx 2 ปีที่แล้ว

      @@trevormckellen5613 you replied to a bot... -_-

  • @godwinsojan6205
    @godwinsojan6205 2 ปีที่แล้ว

    c++ full course please

    • @godwinsojan6205
      @godwinsojan6205 2 ปีที่แล้ว

      @Pínned by Tech With Tim ok I will subscribe and smash like button
      but what about cpp course
      i need cpp
      specialy embed system

    • @godwinsojan6205
      @godwinsojan6205 2 ปีที่แล้ว

      tim replay

    • @godwinsojan6205
      @godwinsojan6205 2 ปีที่แล้ว

      tim please replay by question

  • @nureinmensch3107
    @nureinmensch3107 2 ปีที่แล้ว

    Finally this removes all this big annoying if statements :)

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

    Python 3.10 is the same as 3.1 though! Where’s python 4?!

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

      since when was 10 = 1. im sure that has some serious complications to maths in general if thats true.

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

      @@Altirix_ decimals man, all zeros after a number that is greater than zero gets cut of, 3.1 == 3.10

    • @testk822
      @testk822 2 ปีที่แล้ว

      @@elishashmalo3731 But these are obviously not formatted as doubles? Version numbers such as 3.9.5 exist

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

      @@testk822 yeh but there has nvr been a 3.10.9 b4. The standard rule (which I believe is called “carry the 1”) still applies. This is a new precedent.

    • @Altirix_
      @Altirix_ 2 ปีที่แล้ว

      @@elishashmalo3731 its version numbers, not maths rounding or significant figures do not come into play. seriously did you start rounding up to python 4 when you switched to python 3.5? i sure doubt it

  • @adwdwdwas
    @adwdwdwas 2 ปีที่แล้ว

    I'm still a beginner but this appears similar to the try and except.
    The try being cases and default(wild card) being the except 🤔

    • @jagaya3662
      @jagaya3662 2 ปีที่แล้ว

      I think try-except is used to catch errors, not for regular pattern-matching.
      It looks similar because it does a similar thing, but try-except for a start needs some actual errors to go into the except block - meaning you would need to write the matching in a way, that produces an actual error. The original if-elif-else chains this will replace would need conditions that produce True/False. Meanwhile Match-Case just needs patterns and it will do the comparison for you. No need for conditions, no need for forcing errors.

  • @gameryo3691
    @gameryo3691 2 ปีที่แล้ว

    We just got rickrolled

  • @SkyFly19853
    @SkyFly19853 2 ปีที่แล้ว

    Will it be useful for making video games in 3d?

    • @rylandavis2976
      @rylandavis2976 2 ปีที่แล้ว

      Rule of thumb. Don't make 3d video games in python

    • @SkyFly19853
      @SkyFly19853 2 ปีที่แล้ว

      @@rylandavis2976
      Oh, really? Civ 4 made in Python btw... and people still play it ( including myself ) they made CyberPink 2077 in C# and took them more than 8 years and then... they screwed everything... waste of time resources...

    • @rylandavis2976
      @rylandavis2976 2 ปีที่แล้ว

      @@SkyFly19853 civ 4 is not written in python. Certain parts are. Almost all of the underhood stuff is written in a more technical language because of needs to manage performance and resources. Civ 4 allows python scripting tho

    • @rylandavis2976
      @rylandavis2976 2 ปีที่แล้ว

      @@SkyFly19853 civ 4 was written in c++

    • @SkyFly19853
      @SkyFly19853 2 ปีที่แล้ว

      @@rylandavis2976
      If you check there is plenty of Python with Panda 3d.

  • @parkermathews3422
    @parkermathews3422 2 ปีที่แล้ว

    Whats the point of this... Couldn't you just make a dictonary of values and get the case from that?
    Example:
    values = {"x": "This is x"}
    my_case = "x"
    value = values.get(my_case)
    print(value)

    • @jesuschris9543
      @jesuschris9543 2 ปีที่แล้ว

      it’s probably how you’re supposed to do it. its a lot like using an enum with switch statements in c++

    • @jagaya3662
      @jagaya3662 2 ปีที่แล้ว

      Dictionaries need non-mutable objects as keys and cannot match wildcards either.
      So no, it's not the same.
      It's also not the same in other languages, as the "break" keyword indicated in the beginning - because switch-case would execute all cases after the first true one. Hence the need to include "break" so it doesn't do that. This can technically be used to combine some cases.

    • @parkermathews3422
      @parkermathews3422 2 ปีที่แล้ว

      @@jagaya3662 ohhhh... i see

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

    3rd

  • @wesinec
    @wesinec 2 ปีที่แล้ว

    Aleluia

  • @user-rb1uf4ct9m
    @user-rb1uf4ct9m 2 ปีที่แล้ว +1

    Second

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

    First

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

    Finally it would be easy and less chaotic to make command line programs.