Once you start working with Python more and more chances
are you are going to outgrow using Jupyter Notebook, and you're
going to start using your command line a lot more.
Now, with that comes a Python shell, and you can write all
sorts of Python stuff in here if you wanted to.
We can say 'print(Hi")'.
'def func_name()' doesn't really do auto indenting,
so we've got to indent that for us for ourselves.
'print("Hello")',
and then we could run 'func_name'.
Now, that's not bad.
This is kind of boring to look at, but we can experiment
with some Python in there, or if you want something that's
a little more like Jupyter Notebook, but on your command
line, you can install this thing called 'ipython', and you
can do that with 'pip install
ipython', which I think actually I already have. 'pip freeze ipython'.
I should have it. I use it a lot.
Not 'pip freeze',
I meant 'pip show'.
And yup, I am using IPython7.11.1.
So you can do 'pip install ipython'.
That will get you the latest version of Python or IPython,
rather. An IPython is just interactive Python, and you can
type 'ipython' instead of typing 'python',
and this will give you an interactive shell.
Now you can already see this looks a little bit different.
And let's just make some room here, and let's do the exact
same examples we did in the regular shell.
'print("Hello")'.
So we already have syntax highlighting.
That's nice. That's really nice.
'def func_name()'.
It does auto indentation for us.
That's nice. "Hello World".
We can execute 'func_name' in here.
"Hello world",
and it's just a little nicer.
Now, if you're using interactive Python with a framework
such as Django, it will also do a bunch of automatic imports
for you, which is really, really nice.
Now, while this does do pretty much everything the regular
Python shell does, this is just a little nicer to look at.
And as a little more advanced example of something you can
do in the Python shell, or in the interactive shell that we're using
here, we can import a file or a function from a file.
So let's go ahead and take a look here
what do we have to import.
So I just called 'ipython' from my directory where I have
all of these files here,
and 'custom_module'.
Yeah, so let's do 'from
[no audio]
custom_module', I could do tab completion,
that's nice, 'import',
and if I do tab completion, I can import all sorts of stuff,
but I really only have the one function here called 'my_greeting',
and I can do 'my_greeting()' as a function.
And now I've imported a file. From my computer
I've imported a function, and I've run that function.
And so with interactive Python, you can do all that stuff.
Again, you can do a lot of the stuff with the regular Python
shell, but this one just looks a lot nicer.
This also has a bunch of nice little shortcuts that you can
get into if you want to.
I don't really use too many of them.
I just think this is a nicer version of a Python shell.
So if you like nice things, and you like to have a nice shell,
go ahead, and let's quit this, 'pip install ipython',
and then once you've got that, just run 'ipython'.
[no audio]