Interesting behaviour with the wrong script name choise

One of my students wrote the following script:

import matplotlib.pylab as plt

He named the script numbers.py (because the task was about to process some numbers)

This is the output:
>>> python numbers.py
Traceback (most recent call last):
File “numbers.py”, line 1, in
import matplotlib.pylab as plt
File “/home/a1634120/anaconda3/lib/python3.7/site-packages/matplotlib/init.py”, line 138, in
from . import cbook, rcsetup
File “/home/a1634120/anaconda3/lib/python3.7/site-packages/matplotlib/cbook/init.py”, line 17, in
import numbers
File “/home/a1634120/matplotlib_case/numbers.py”, line 1, in
import matplotlib.pylab as plt
File “/home/a1634120/anaconda3/lib/python3.7/site-packages/matplotlib/pylab.py”, line 214, in
from matplotlib.cbook import flatten, silent_list, iterable, dedent
ImportError: cannot import name ‘flatten’ from ‘matplotlib.cbook’ (/home/a1634120/anaconda3/lib/python3.7/site-packages/matplotlib/cbook/init.py)

Interesting isn’t?

numbers is a part of the standard library. You should not name your files to clash with standard library files. This doesn’t really have anything to do with Matplotlib, but with how Python works.