I'm studying matplotlib and I have a question.
Why just putting a comma in var_1
, the type of the variable changes completely, it becomes Line2D
, while without the comma the type is list
?
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
var_1, = ax.plot([], [])
var_2 = ax.plot([], [])
print(type(var_1), type(var_2))
#<class 'matplotlib.lines.Line2D'> <class 'list'>