Skip to content

Tag: ipython

How to display audio at the right side of matplotlib

The following code display the image and audio in the top-bottom style: Here is the test code: Is it possible for changing the “top-bottom” style to “left-right” style for displaying the audio at the right side of the plt figure? Answer You can use a GridspecLayout which is similar to matplotlib’s GridSpec. In order to direct to output into the

Python deque maxlen does not show

I have result but in book Fluent Python (2019), I see maxlen, like this Is the different cause by version different? Answer This seems to be caused by IPython. If you do print(dq) or print(repr(dq)), you get your expected output, and same in a normal REPL. Update: I’ve submitted a PR to IPython to fix the problem.

Inputting just a comma returns strange behaviour

Today I by mistake inputted just a comma on an interactive session Input: and I noticed strangely that it did not return an error but instead: Output So I explored a bit this behaviour and tried some random stuff, and it seems like it creates tuples of strings, but it seems like these objects cannot be interacted with: returns: Trying

Strange autocomplete suggestions in IPython Shell

I use the IPython shell fairly often and have just started to notice it giving me strange autocomplete suggestions without any prompting from me. In this example, I just typed “im” and it suggests importing matplotlib? This is very strange for several reasons: I’ve never seen this kind of grayed out code suggestion before that appears just as I type

command line ipython with –pylab + more imports

The –pylab command line arguments makes ipython a quick but powerful calculator in the terminal window which I use quite often. Is there a way to pass other useful imports to ipython via command line, such as which makes it even more convenient to use? Answer If you have installed sympy you get script that starts ipython with sympy imports.