Python 3.13's new REPL is AMAZING

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 145

  • @randyt700
    @randyt700 2 місяці тому +117

    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 2 місяці тому +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 2 місяці тому

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

    • @wrathofainz
      @wrathofainz 2 місяці тому

      @@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 2 місяці тому

      Agree, easier now

    • @slipperynickels
      @slipperynickels 2 місяці тому

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

  • @aafrophonee
    @aafrophonee 2 місяці тому +40

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

    • @kimuyu
      @kimuyu Місяць тому

      ptpython is cooler.

  • @pramodjingade6581
    @pramodjingade6581 2 місяці тому +14

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

    • @Carberra
      @Carberra  2 місяці тому +1

      Thank you!

    • @jamesbond_007
      @jamesbond_007 2 місяці тому

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

  • @linuxhog
    @linuxhog 2 місяці тому +86

    exit in new python REPL has been a godsend

    • @Carberra
      @Carberra  2 місяці тому +14

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

    • @samjiman
      @samjiman 2 місяці тому +5

      exit() was a minor pain.

    • @devonoffutt3384
      @devonoffutt3384 2 місяці тому +2

      Just type exit()...

    • @jamesbond_007
      @jamesbond_007 2 місяці тому +3

      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.

    • @обычныйчел-я3е
      @обычныйчел-я3е Місяць тому

      ​@@squishy-tomatoctrl+d makes it easy to accidentally exit the top-level shell right after exiting Python repl

  • @laurentverweijen9195
    @laurentverweijen9195 2 місяці тому +12

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

    • @spacelem
      @spacelem 2 місяці тому +2

      Julia's REPL is great! It is also the inspiration for radian, an alternative REPL for R (written in Python!) which I always use now if I'm not in the IDE.

    • @harishs9003
      @harishs9003 Місяць тому

      Cant wait to try it

  • @StephenAngelico
    @StephenAngelico 2 місяці тому +10

    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.

    • @ultru3525
      @ultru3525 2 місяці тому

      i'm glad to be reminded of `exit()` because IPDB breakpoints get easily borked when doing async stuff, causing the terminal to stop intercepting CTRL commands. Up until now, I either closed the TTY or sent a kill signal to the PID, but `exit` works way better (and is already standard in iPython)

  • @vishtem33
    @vishtem33 2 місяці тому +27

    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  2 місяці тому

      Ah nice, thanks for that!

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 2 місяці тому +4

    simple and to the point, thank you

  • @RoamingAdhocrat
    @RoamingAdhocrat 2 місяці тому +2

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

  • @ugurunver2403
    @ugurunver2403 2 місяці тому +28

    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  2 місяці тому +7

      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 2 місяці тому

      @@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  2 місяці тому +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!

  • @cunningham.s_law
    @cunningham.s_law 2 місяці тому +33

    you can clear the old repl with ctrl-l

    • @Carberra
      @Carberra  2 місяці тому +7

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

    • @danielandreasen2293
      @danielandreasen2293 2 місяці тому +6

      Also works in the terminal (normally)

    • @vishtem33
      @vishtem33 2 місяці тому +2

      @@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  2 місяці тому

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

    • @Redditard
      @Redditard 2 місяці тому

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

  • @caruccio
    @caruccio 2 місяці тому +10

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

  • @meowsqueak
    @meowsqueak 2 місяці тому +6

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

  • @divy1211
    @divy1211 2 місяці тому +2

    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!

  • @saurabhjain2437
    @saurabhjain2437 2 місяці тому +2

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

    • @jamesbond_007
      @jamesbond_007 2 місяці тому +1

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

  • @pythonwithjames
    @pythonwithjames 2 місяці тому +2

    really nice, thanks for this!

  • @k98killer
    @k98killer 2 місяці тому +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.

  • @JoeBurnett
    @JoeBurnett 2 місяці тому

    Great information. Thanks!

  • @mrbrent62
    @mrbrent62 2 місяці тому

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

  • @beaverbuoy3011
    @beaverbuoy3011 2 місяці тому

    Awesome!

  • @curtarnolds
    @curtarnolds 2 місяці тому +4

    ipython has had this forever

  • @puyodead1
    @puyodead1 2 місяці тому

    Omg these changes are great

  • @rudolfvaneulenstein9896
    @rudolfvaneulenstein9896 2 місяці тому

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

  • @hansdietrich1496
    @hansdietrich1496 Місяць тому +1

    Conclusion in one sentence: python repl is now ipython. Skip ipython for the future.

  • @madst7521
    @madst7521 2 місяці тому +1

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

  • @pixelfairy
    @pixelfairy 2 місяці тому

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

  • @michaeldeloatch7461
    @michaeldeloatch7461 2 місяці тому

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

  • @mehdiyahiacherif2326
    @mehdiyahiacherif2326 2 місяці тому +5

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

    • @Carberra
      @Carberra  2 місяці тому +3

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

  • @scottmiller2591
    @scottmiller2591 2 місяці тому

    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.

  • @jamesbond_007
    @jamesbond_007 2 місяці тому

    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.

  • @bew
    @bew 2 місяці тому +1

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

  • @PaulWayper
    @PaulWayper 2 місяці тому

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

    • @Carberra
      @Carberra  2 місяці тому

      It's the channel's name 😅

    • @PaulWayper
      @PaulWayper 2 місяці тому

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

    • @Carberra
      @Carberra  2 місяці тому

      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!

  • @revengerwizard
    @revengerwizard 2 місяці тому +5

    What about the JIT :(

  • @Landee
    @Landee 2 місяці тому +1

    Damn finally, ty python

  • @majvax
    @majvax 2 місяці тому

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

  • @MadlipzMarathi
    @MadlipzMarathi 2 місяці тому +41

    who uses python repl, just use ipython

    • @AlamKhan-yt9wd
      @AlamKhan-yt9wd 2 місяці тому

      What is ipython?

    • @ccgarciab
      @ccgarciab 2 місяці тому +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 2 місяці тому +3

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

    • @Seerinx
      @Seerinx 2 місяці тому +4

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

    • @Chr0n0s38
      @Chr0n0s38 2 місяці тому

      Some work environments look you down pretty heavily.

  • @eignnx_1738
    @eignnx_1738 2 місяці тому +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  2 місяці тому +1

      You can probably use importlib.reload(module).

  • @chyldstudios
    @chyldstudios 2 місяці тому +2

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

  • @roganl
    @roganl 2 місяці тому +11

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

    • @suki4410
      @suki4410 2 місяці тому +1

      Please stop smoking.

    • @jamesbond_007
      @jamesbond_007 2 місяці тому

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

    • @roganl
      @roganl 2 місяці тому

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

  • @mikeg9b
    @mikeg9b 2 місяці тому

    Why use exit and clear when you can use Ctrl-D and Ctrl-L?

  • @lohikarhu734
    @lohikarhu734 2 місяці тому +2

    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  2 місяці тому +2

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

    • @jamesbond_007
      @jamesbond_007 2 місяці тому +1

      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 2 місяці тому +1

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

    • @jamesbond_007
      @jamesbond_007 2 місяці тому

      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?

    • @jonathanjohnston9272
      @jonathanjohnston9272 Місяць тому

      I know this late, but F3 for paste mode. The "What's new" part of the standard docs for Python 3.13 cover the new REPL fairly well.

  • @Spiderfffun
    @Spiderfffun 2 місяці тому

    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)`

  • @linearj2951
    @linearj2951 2 місяці тому

    Most importantly, how does one disable colors and autoindent?

    • @Carberra
      @Carberra  2 місяці тому

      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 2 місяці тому

      @@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

  • @Cdaprod
    @Cdaprod 2 місяці тому

    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

  • @teluial
    @teluial 2 місяці тому

    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.

  • @harishs9003
    @harishs9003 Місяць тому

    Wow

  • @sihker
    @sihker 2 місяці тому +1

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

    • @Carberra
      @Carberra  2 місяці тому

      Hm? ^L and ^D work fine.

    • @sihker
      @sihker 2 місяці тому

      @@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 2 місяці тому +1

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

  • @aDifferentJT
    @aDifferentJT 2 місяці тому

    In vim paste mode will disable auto-indent

  • @vijayramachandran3559
    @vijayramachandran3559 2 місяці тому +2

    ipython 😅

  • @Cdaprod
    @Cdaprod 2 місяці тому

    They need to handle the f key state or something

  • @lokeshkalamalla
    @lokeshkalamalla 2 місяці тому +2

    Ipython

  • @Dogo.R
    @Dogo.R 2 місяці тому +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 2 місяці тому

      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.

  • @duality4y
    @duality4y 2 місяці тому +1

    Ptpython still beter imho

  • @forivall
    @forivall 2 місяці тому

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

  • @jancicruz7
    @jancicruz7 2 місяці тому +1

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

    • @Carberra
      @Carberra  2 місяці тому +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 2 місяці тому +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 2 місяці тому

      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 2 місяці тому

      @@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.

  • @xxlarrytfvwxx9531
    @xxlarrytfvwxx9531 2 місяці тому

    I just use `py -m idlelib`

  • @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😊

  • @birdbeakbeardneck3617
    @birdbeakbeardneck3617 2 місяці тому

    and multiline

  • @daviddanielng
    @daviddanielng 2 місяці тому

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

    • @Carberra
      @Carberra  2 місяці тому +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 2 місяці тому

      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

  • @williamsloan7857
    @williamsloan7857 2 місяці тому +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  2 місяці тому +2

      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.

  • @shreekss2539
    @shreekss2539 2 місяці тому

    Calfreezy?

  • @suki4410
    @suki4410 2 місяці тому

    Nice, but Python 3.14 will be much better.

  • @JonitoFischer
    @JonitoFischer 2 місяці тому +2

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

  • @theevilcottonball
    @theevilcottonball 2 місяці тому

    So cool. What's next? Mouse support?

  • @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?

  • @charlesspringer4709
    @charlesspringer4709 2 місяці тому +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!

  • @wojciechzakrzewski5816
    @wojciechzakrzewski5816 2 місяці тому

    yyyyy yyy

  • @replikvltyoutube3727
    @replikvltyoutube3727 2 місяці тому

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

    • @vytah
      @vytah 2 місяці тому

      Brackets without print

  • @Chris-op7yt
    @Chris-op7yt 2 місяці тому +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.

  • @adblocker276
    @adblocker276 2 місяці тому

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

  • @cryptixdaemon7236
    @cryptixdaemon7236 2 місяці тому +1

    Perhaps you need to prepare before you make videos

    • @Carberra
      @Carberra  2 місяці тому +2

      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.

  • @sachof
    @sachof Місяць тому

    Looks useless compared to ipython

  • @JeanMarieGalliot
    @JeanMarieGalliot 2 місяці тому

    It is very difficult to understand you. Too fast and mumbling