[Python Tips] A better interactive shell

in #programming6 years ago

If you frequently use python interactively by typing in python or python3 then you will really love this next tip.

There is a better interactive python shell that has in-line syntax highlighting and code insight (aka autocomplete). The code insight isn't perfect and doesn't work 100% of the time but it does work most of the time. The syntax highlighting is really nice as well.

Do these features look good?

  • In-line syntax highlighting
  • Readline-like autocomplete with suggestions displayed as you type.
  • Expected parameter list for any Python function.
  • "Rewind" function to pop the last line of code from memory and re-evaluate.
  • Send the code you've entered off to a pastebin.
  • Save the code you've entered to a file.
  • Auto-indentation.
  • Python 3 support.

Introducing bpython!

Bpython is an interactive shell for python that has powerful features that mimic a quality IDE. In the end it is still a low level interpreted shell, but it can drastically improve your quality of life if you frequently use the interactive shell.

Starting bpython

Code completion

Code Insight

Docstring support

Syntax Highlighting

image.png

Send session to external editor (F7)

Send session to pastebin (F8)

There is a short five-minute video the developers made that show off the features that is worth checking out if you want to see it in action.

Python Tips Series

X48EJ

Why you should vote me as witness

Witness & Administrator of four full nodes

themarkymark.png

My recent popular posts

STEEM, STEEM Power, Vests, and Steem Dollars. wtf is this shit?
The truth and lies about 25% curation, why what you know is FAKE NEWS
WTF is a hardware wallet, and why should you have one?
GINABOT - The Secret to your Sanity on Steemit
How to calculate post rewards
Use SSH all the time? Time for a big boy SSH Client
How to change your recovery account
How curation rewards work and how to be a kick ass curator
Markdown 101 - How to make kick ass posts on Steemit
Work ON your business, not in your business! - How to succeed as a small business
You are not entitled to an audience, you need to earn it!
How to properly setup SSH Key Authentication - If you are logging into your server with root, you are doing it wrong!
Building a Portable Game Console

Sort:  

Looks good, I will have to try it out. Not that often I do things in the interactive shell but I might find it less annoying using this :)

I use it a lot when querying the blockchain and testing things. Although I use a database far more often nowadays.

Really nice subject

the truth that if it works well 30% of the time I'm happy hahaha, I'll take a look to see

And if you're looking for something with a little more horsepower, a little more flexibility in the way that it allows you to work with the platform, and eventually can give you the ability to just write the document and code together that you need to explain what you want to convey, check out Jupyter Notebook and prepare to find yourself in an environment which truly makes coding and talking about that code far, far easier.

It's how I write my most complicated pieces while keeping them sane and coherent.

I love notebooks. When doing ML they are amazing. I use them more often than interactive.

Yes, notebooks are perfect for ML.

great tips! i started using python recently. so far i'm loving it. great post!