Python 3.13's new REPL is AMAZING

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 ก.ย. 2024

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

  • @randyt700
    @randyt700 18 วันที่ผ่านมา +88

    The multi line editing change is awesome. It was so annoying to accidentally close out the multi line code and have to re-enter each line toggling through history one by one.

    • @wrathofainz
      @wrathofainz 18 วันที่ผ่านมา +7

      Oh my god, yes, this shit.
      It ends up being easier to just create and run an entire new python file then to interact with the terminal.

    • @randyt700
      @randyt700 14 วันที่ผ่านมา

      @@wrathofainz lol yup. I mean, yeah we have ipython but its so much easier to just pull up a terminal

    • @wrathofainz
      @wrathofainz 14 วันที่ผ่านมา

      @@randyt700 I just meant when testing individual functions and classes and stuff.
      I always have a terminal open, its built into the file browser :)

    • @minastaros
      @minastaros 7 วันที่ผ่านมา

      Agree, easier now

    • @slipperynickels
      @slipperynickels วันที่ผ่านมา

      @@randyt700you just reminded me to reinstall bpython, thanks (legitimately)

  • @linuxhog
    @linuxhog 19 วันที่ผ่านมา +74

    exit in new python REPL has been a godsend

    • @Carberra
      @Carberra  19 วันที่ผ่านมา +12

      I always use CTRL+D to exit, so never really ran into that annoyance, but the new way certainly does make much more sense.

    • @squishy-tomato
      @squishy-tomato 18 วันที่ผ่านมา +6

      Ctrl+D is the best, also works for the terminal itself and other CLI apps.

    • @samjiman
      @samjiman 18 วันที่ผ่านมา +4

      exit() was a minor pain.

    • @devonoffutt3384
      @devonoffutt3384 18 วันที่ผ่านมา +2

      Just type exit()...

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา +2

      I like the fact that `exit` is now standard across top level REPL, help mode, etc, instead of having each "mode" have its own way to exit that mode.

  • @aafrophonee
    @aafrophonee 18 วันที่ผ่านมา +11

    I forgot that Python has it's own REPL. * Insert obligatory "I use IPython" comment here *

  • @vishtem33
    @vishtem33 18 วันที่ผ่านมา +22

    7:48 : I think this is an implementation of bracketed paste (which is basically a terminal feature, but a pretty common one). The action of pasting , when received by the terminal, "prints" certain control codes indicating the beginning and end of a paste block. 3.13 appears to interpret these and therefore can actually tell the difference between 'the user typing a pile of individual lines' and 'pasting a block of text'.

    • @Carberra
      @Carberra  18 วันที่ผ่านมา

      Ah nice, thanks for that!

  • @ugurunver2403
    @ugurunver2403 18 วันที่ผ่านมา +27

    So there is a little bit of inspiration from IPython, am I right? I love when a 3rd party package works so well and someday made its way into the official repo.

    • @Carberra
      @Carberra  18 วันที่ผ่านมา +5

      It's mainly based on PyPy's, though I'd be surprised if they didn't take _some_ inspiration from it. I know they intentionally didn't go as far as IPython does though.

    • @ugurunver2403
      @ugurunver2403 18 วันที่ผ่านมา

      @@Carberra I think some parts of it would be enough. Because i mostly use that parts / features. I know it's personal but i like it anyway. I like how independent devs and communities contribute the user experience of the official end product, anyway. But i understand your point. You are right ofcourse.

    • @Carberra
      @Carberra  18 วันที่ผ่านมา +5

      PyPy is a third-party, so technically that is still happening! I didn't mention it in the video, but the new REPL is built in Python, meaning it'll be much easier for Python devs to contribute back into it!

  • @pramodjingade6581
    @pramodjingade6581 18 วันที่ผ่านมา +7

    Love how you compare the terminals side by side. Nicely presented 👍🏻

    • @Carberra
      @Carberra  18 วันที่ผ่านมา

      Thank you!

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      I'll second that -- it was a great, fast way to show very directly the differences!

  • @StephenAngelico
    @StephenAngelico 18 วันที่ผ่านมา +5

    I had forgotten about exit() because I always use Ctrl-D, but colours, better indicators on exceptions, and multi-line editing are all fantastic things I'm looking forward to.

  • @laurentverweijen9195
    @laurentverweijen9195 13 วันที่ผ่านมา +3

    Julia has an even nicer repl. To get into help mode, just press "?" To exit it, just press backspace again.

  • @cunningham.s_law
    @cunningham.s_law 19 วันที่ผ่านมา +29

    you can clear the old repl with ctrl-l

    • @Carberra
      @Carberra  19 วันที่ผ่านมา +5

      Huh, I didn't know that! Clear command is definitely more clear though (if you'll excuse the pun!).

    • @danielandreasen2293
      @danielandreasen2293 18 วันที่ผ่านมา +4

      Also works in the terminal (normally)

    • @vishtem33
      @vishtem33 18 วันที่ผ่านมา +1

      @@CarberraI hope ^l is in the new repl too (arguably both `clear` and ^l are standard ways of doing this in command shells like bash, so it would make sense to support both IMO)

    • @Carberra
      @Carberra  18 วันที่ผ่านมา

      Yeah, it works! Ignore my last comment, I read it as CTRL+I (I for India) rather than CTRL+L, rip.

    • @Redditard
      @Redditard 18 วันที่ผ่านมา

      Tried Ctrl+I, didn't work, glad i did Ctrl+L after

  • @meowsqueak
    @meowsqueak 17 วันที่ผ่านมา +5

    Hey look it’s just like ipython :). Nice to have without the extra dependency though.

  • @caruccio
    @caruccio 18 วันที่ผ่านมา +6

    That "complex" help is from "less", the linux pageR. It's read from env var PAGER.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 18 วันที่ผ่านมา +4

    simple and to the point, thank you

  • @k98killer
    @k98killer 18 วันที่ผ่านมา +2

    I first encountered auto indentation and paste mode with the micropython REPL a couple weeks ago. Now that I have gotten used to it, I think I like it more than the regular REPL.

  • @divy1211
    @divy1211 18 วันที่ผ่านมา +1

    I use the ipython command from jupyter for a repl instead of the default one. Nice to see the default shell is getting up there too now!

  • @pythonwithjames
    @pythonwithjames 19 วันที่ผ่านมา +2

    really nice, thanks for this!

  • @rudolfvaneulenstein9896
    @rudolfvaneulenstein9896 11 วันที่ผ่านมา

    by the way: to log out of any terminal session, you can generally use Ctrl+D, which sends a logout command

  • @curtarnolds
    @curtarnolds 15 วันที่ผ่านมา +2

    ipython has had this forever

  • @saurabhjain2437
    @saurabhjain2437 18 วันที่ผ่านมา +1

    Thanks for the video. FYI, ^L clears clears screen on the old repl (tested on mac and Linux).

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      I think this is true for generally anything that uses the readline library for handling input (so bash gets it too).

  • @PaulWayper
    @PaulWayper วันที่ผ่านมา

    Feels like the "CAR BER RA" sign in the background needs explanation 🙂

    • @Carberra
      @Carberra  วันที่ผ่านมา

      It's the channel's name 😅

    • @PaulWayper
      @PaulWayper วันที่ผ่านมา

      @@Carberra LOL. For some weird reason I thought this was a subtle way of saying you were in Canberra.

    • @Carberra
      @Carberra  วันที่ผ่านมา

      Google thought the same for about two years, so you're not the first lmao. Didn't realise how similar it was until it was too late!

  • @RoamingAdhocrat
    @RoamingAdhocrat 17 วันที่ผ่านมา +1

    I've been using the ptpython repl for years, which gives most/all of these benefits and works on earlier versions of Python

  • @MadlipzMarathi
    @MadlipzMarathi 18 วันที่ผ่านมา +38

    who uses python repl, just use ipython

    • @AlamKhan-yt9wd
      @AlamKhan-yt9wd 18 วันที่ผ่านมา

      What is ipython?

    • @ccgarciab
      @ccgarciab 18 วันที่ผ่านมา +7

      ​@@AlamKhan-yt9wd an improved Python repl that has been around for years and supports many features like auto completion, color, references to executed commands and more (there are many but idk all of them)

    • @caruccio
      @caruccio 18 วันที่ผ่านมา +3

      Try that in a remote server you are just giving maintenance.

    • @Seerinx
      @Seerinx 17 วันที่ผ่านมา +4

      because it's a default, and having good defaults is good

    • @Chr0n0s38
      @Chr0n0s38 16 วันที่ผ่านมา

      Some work environments look you down pretty heavily.

  • @mrbrent62
    @mrbrent62 9 วันที่ผ่านมา

    I’ve never written Python. It looks cool. I have prompted a few programs.

  • @roganl
    @roganl 18 วันที่ผ่านมา +11

    ***cough** **cough** Ctrl+L **cough** --easier to type than 'clear' , Just Works™

    • @suki4410
      @suki4410 17 วันที่ผ่านมา +1

      Please stop smoking.

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      I love how ^L is something new to these younger guys who try to present themselves overconfidently as uber-hackers.

    • @roganl
      @roganl 14 วันที่ผ่านมา

      @@jamesbond_007 As my father loved to say “Quick hire a teenager while they still know it all!”

  • @Dogo.R
    @Dogo.R 18 วันที่ผ่านมา +5

    Looks like pythons slowly getting feature parody with clojure. Nice to see considering the mistake of ml and ai ending up being built on top of python.

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      Few people appreciate clojure, unfortunately. Even back in the 70s INTERLISP had the DWIM facility -- doing auto spelling correction, I think completion, and allowing reediting of commands and lots of other amazing things. It was truly ahead of its time, and made doing REPL development a joy. I should probably do more clojure hacking -- it's a cool language that's portable has heck, and interoperable with Java (and the JVM) which is a big plus.

  • @revengerwizard
    @revengerwizard 18 วันที่ผ่านมา +5

    What about the JIT :(

  • @beaverbuoy3011
    @beaverbuoy3011 11 วันที่ผ่านมา

    Awesome!

  • @JoeBurnett
    @JoeBurnett 18 วันที่ผ่านมา

    Great information. Thanks!

  • @scottmiller2591
    @scottmiller2591 18 วันที่ผ่านมา

    Yes, multiline editing looks improved - I hated the old way. Things like 'exit" (or 'quit', which is what I normally used) needing () was never a problem for me - it's Python, and they're functions - but I can see how some people would like it better - they intuit that 'exit' should be a REPL command, and not a Python function. I haven't tried it, but paste *might* let you paste from the terminal (that is, key in lines manually, not from the buffer) as well as paste from the buffer. This would let you do multiblock pasting while interspersing a line of interface between blocks. Still seems like an almost insignificant difference, though.

  • @bew
    @bew 18 วันที่ผ่านมา +1

    w.r.t. clear, it was always possible to use Ctrl-L though, which clears the screen like `clear` in ~all terminal programs ;)

  • @jamesbond_007
    @jamesbond_007 14 วันที่ผ่านมา

    Thanks for doing this video! Do you happen to know if there's a capability of instead of doing multiline editing "inline" you can instead have the multiline editing text sent off to the $EDITOR (i.e. an Emacs server) so you can edit it there instead? Bash has this capability with the `fc` command. It allows one to use any custom editing macros or templates that you've created or installed to speed up the editing, as well as being able to easily copy/paste from another buffer in the editor server into the multiline text being edited. `fc` works with the entire content of the last command, even if it's a multiline command.

  • @michaeldeloatch7461
    @michaeldeloatch7461 13 วันที่ผ่านมา

    Well, I am sold with the purple prompt. The '(' and ')' characters are going to get lonely.

  • @eignnx_1738
    @eignnx_1738 17 วันที่ผ่านมา +1

    I really hope they add module reloading (is this already a thing? I've never been able to find a way). In the Haskell repl you can type `:r` and it will reload any module file that has changed. Super helpful and doesn't require exiting the repl.

    • @Carberra
      @Carberra  17 วันที่ผ่านมา +1

      You can probably use importlib.reload(module).

  • @chyldstudios
    @chyldstudios 18 วันที่ผ่านมา +2

    I use "ipython", but maybe I'll switch to this.

  • @mehdiyahiacherif2326
    @mehdiyahiacherif2326 18 วันที่ผ่านมา +3

    I am using bpython right now, not sure this new repl will change a lot

    • @Carberra
      @Carberra  18 วันที่ผ่านมา +3

      Holy hell, just looked that up and it looks awesome! Will have to try that.

  • @puyodead1
    @puyodead1 17 วันที่ผ่านมา

    Omg these changes are great

  • @pixelfairy
    @pixelfairy 18 วันที่ผ่านมา

    Glad to see the 3rd party stuff find its way back up stream. Wonder if Mojo inspired any of the new jit.

  • @teluial
    @teluial 18 วันที่ผ่านมา

    The REPL executes after two new lines. If you have two new lines in your class definition, it beaks on paste. In paste mode, it doesn’t do that… I presume.

  • @Landee
    @Landee 18 วันที่ผ่านมา +1

    Damn finally, ty python

  • @madst7521
    @madst7521 18 วันที่ผ่านมา

    I’ve been using ptpython instead of the built in repl and I think I will stick to that for now.

  • @majvax
    @majvax 18 วันที่ผ่านมา

    I only used repl to convert dec to hex, I'm sure those features will come handy

  • @aDifferentJT
    @aDifferentJT 12 วันที่ผ่านมา

    In vim paste mode will disable auto-indent

  • @Cdaprod
    @Cdaprod 18 วันที่ผ่านมา

    Can I press up on a multi line and go into the cursor and highlight multi lines at a time and cut out directly? :3

  • @sihker
    @sihker 18 วันที่ผ่านมา +1

    So, the ^l and ^d are too hard, but F1 and f2 are totally fine?

    • @Carberra
      @Carberra  18 วันที่ผ่านมา

      Hm? ^L and ^D work fine.

    • @sihker
      @sihker 18 วันที่ผ่านมา

      @@Carberra sorry you missed my point 😊 clear and exit can hardly be considered new, as they already worked before. They were obscure key bindings like F1 and f2.

    • @mudi2000a
      @mudi2000a 18 วันที่ผ่านมา +1

      F1 for help is universal on Windows and Mac. Works in nearly every application. F2 you need to memorize…

  • @lohikarhu734
    @lohikarhu734 17 วันที่ผ่านมา +1

    Colour selection; it sounds like there was little thought toward the ~7% of men who have a colour vision deficiency? Or, can users select a colour palette designed to work with the typical red/green problems?
    It's just a thought.

    • @Carberra
      @Carberra  17 วันที่ผ่านมา +1

      You can't select a palette (yet), but you can turn the colours off entirely using environment variables.

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      Good point. Things like this should at least be aware of accessibility issues, and allow accommodations. I'm glad you brought this up!

  • @caruccio
    @caruccio 18 วันที่ผ่านมา +1

    How to enter the paste mode? Maybe I lost it in translation.

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      Yeah -- I didn't see it either -- the video was talking about paste mode, but didn't make it plain (and as a native English speaker for > 60 years, I don't think it was lost in translation) what put you into paste mode. It's like suddenly, as if by magic, you're in paste mode. If you blinked, you didn't hear about the F1 to go into help mode either, so maybe there's an F key that enables paste mode?

  • @charlesspringer4709
    @charlesspringer4709 14 วันที่ผ่านมา +1

    It would be great of YT creators got past describing what they are going to talk about when it is a 10 minute video. Why would anyone click (or you want them to click) if they don't know what it is? And the title says what you are going to talk about. See Project Farm or Scotty Kilmer for how to just launch in this age of fast media.
    Q: How do you get color in a dumb terminal? This must assume you are on a PC. Not a serial connection to an embedded system?
    Anyway, why didn't you fix your errors? Why do I have to watch them? Criminy!

  • @Spiderfffun
    @Spiderfffun 18 วันที่ผ่านมา

    man i just use xonsh and it's a shell with all the issues you talked about that dont exist
    a shell, not just interactive python. so i can execute `ls /bin` or `ls @(mydirectoryvariable)`

  • @Cdaprod
    @Cdaprod 18 วันที่ผ่านมา

    They need to handle the f key state or something

  • @linearj2951
    @linearj2951 14 วันที่ผ่านมา

    Most importantly, how does one disable colors and autoindent?

    • @Carberra
      @Carberra  14 วันที่ผ่านมา

      You can use the PYTHON_COLORS environment variable to disable colours, and PYTHON_BASIC_REPL to disable the autoindenting (by disabling the new REPL in its entirety).

    • @linearj2951
      @linearj2951 14 วันที่ผ่านมา

      @@Carberra I like some of the features like multiline editing, though. I just can't stand colors and the automated syntax like autoindent. I hope they provide an option to just disable it

  • @BigOlKnothead
    @BigOlKnothead 2 วันที่ผ่านมา

    people genuinelymuse the repl terminal? fer why? the damn page edito4 the code written, get this, is still there if leave and come back😊

  • @daviddanielng
    @daviddanielng 14 วันที่ผ่านมา

    so the name is REPL, i just call it interactive shell.😅

    • @Carberra
      @Carberra  14 วันที่ผ่านมา +1

      To be honest I always thought it was just the interactive shell too, until very recently! Both terms are fine though as far as I know.

    • @flamingspinach
      @flamingspinach 3 วันที่ผ่านมา

      it stands for Read-Eval-Print Loop because that's how it works - it reads input from you, evaluates the code you typed, prints the output, and then repeats the process over and over again

  • @forivall
    @forivall 18 วันที่ผ่านมา

    Does this mean I don't need to use bpython anymore.... I shall find out with the rest of the video

  • @williamsloan7857
    @williamsloan7857 18 วันที่ผ่านมา +1

    The colorization is not a good thing for people with color deficient vision. I wish there was a way to turn it off.

    • @Carberra
      @Carberra  18 วันที่ผ่านมา +1

      There is! You can set the PYTHON_COLORS environment variable to 0 to disable colour, and the PYTHON_BASIC_REPL variable to 1 to disable the new REPL entirely.

  • @xxlarrytfvwxx9531
    @xxlarrytfvwxx9531 18 วันที่ผ่านมา

    I just use `py -m idlelib`

  • @jancicruz7
    @jancicruz7 19 วันที่ผ่านมา +1

    can anyone enlighten me why would anyone use this instead of an IDE?

    • @Carberra
      @Carberra  19 วันที่ผ่านมา +5

      I use it to quickly test things without having to create a file and save it to disk, but one of the main motivations for improving this was that a lot of people get taught in the REPL to begin with before moving onto an editor. I was quite surprised to hear that myself, but that's an official stance.

    • @retagainez
      @retagainez 18 วันที่ผ่านมา +1

      I think it's important to realize Python is known for being a beginner language, but I'm unsure how one would use it once they're past that initial beginner stage and are used to developing on larger projects. Even if you want to continue using something lightweight, there are plenty of tools that allow for ephemeral, lightweight, portable, and language agnostic building, testing, code execution environments.

    • @mudi2000a
      @mudi2000a 18 วันที่ผ่านมา

      Because you don’t need a file. I use pycharm but I still use the repl (albeit ipython or the pycharm integrated one) all the time.

    • @jancicruz7
      @jancicruz7 18 วันที่ผ่านมา

      @@mudi2000a yeah I get that. If I want to quickly try or test something, I just open up one of my test_72384.ipynb jupyter notebooks and chuck it in there :D I get syntax highlight, intellisense, etc and dont have to limit myself to a terminal.

  • @theevilcottonball
    @theevilcottonball 18 วันที่ผ่านมา

    So cool. What's next? Mouse support?

  • @lokeshkalamalla
    @lokeshkalamalla 18 วันที่ผ่านมา +1

    Ipython

  • @Chris-op7yt
    @Chris-op7yt 17 วันที่ผ่านมา +1

    truly amazing 70s new tech, lol.
    colors are a mistake, just make things clear, without colors, it's not that hard. must be rust programmers.

  • @birdbeakbeardneck3617
    @birdbeakbeardneck3617 19 วันที่ผ่านมา

    and multiline

  • @JonitoFischer
    @JonitoFischer 18 วันที่ผ่านมา +1

    As a user of ipython, improvements on the repl are not a big news...

  • @suki4410
    @suki4410 17 วันที่ผ่านมา

    Nice, but Python 3.14 will be much better.

    • @Carberra
      @Carberra  16 วันที่ผ่านมา +1

      π

    • @jamesbond_007
      @jamesbond_007 14 วันที่ผ่านมา

      Yep, the REPL will be easy as pi.

  • @vijayramachandran3559
    @vijayramachandran3559 17 วันที่ผ่านมา +1

    ipython 😅

  • @ross9263
    @ross9263 2 วันที่ผ่านมา

    Its “gih” it not “jih” it. Gosh didnt we learn from gifs?

    • @Carberra
      @Carberra  2 วันที่ผ่านมา

      Not sure what word this is relating to, can you clarify?

  • @adblocker276
    @adblocker276 11 วันที่ผ่านมา

    You plebs still using stock REPL? What’s wrong with you people?

  • @wojciechzakrzewski5816
    @wojciechzakrzewski5816 วันที่ผ่านมา

    yyyyy yyy

  • @replikvltyoutube3727
    @replikvltyoutube3727 18 วันที่ผ่านมา

    Python 2, print without brackets
    Python 3, print with brackets, exit without brackets
    Python 4, ??
    It feels like history repetition

    • @vytah
      @vytah 18 วันที่ผ่านมา

      Brackets without print

  • @cryptixdaemon7236
    @cryptixdaemon7236 14 วันที่ผ่านมา +1

    Perhaps you need to prepare before you make videos

    • @Carberra
      @Carberra  14 วันที่ผ่านมา +1

      Perhaps if you have a criticism, you could actually say what I did wrong so I could improve for next time. Vague comments like this don't help anyone.