Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Python for Beginners Errors

In error messages why are variables and functions called "name" instead of "variable"?

Consider the following Python code:

x = 10

Is x a variable or a name or both?

Also, why must error messages be so cryptic?

print("Hello)

generates an error message about an EOL and scanning etc. Why not simply say "You forgot the closing quote"?

2 Answers

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

I would say: x is a variable that has the "name" x. Something "being a name" doesn't have a meaning in Python.

Also, why must error messages be so cryptic?

Python error messages seem cryptic, but are actually hyper-overly-specific. Since the Python interpreter doesn't know what the programmer intends, it has to interpret everything literally and respond based on what it sees.

print("Hello) generates an error message about an EOL and scanning etc. Why not simply say "You forgot the closing quote"?

The full error message is "SyntaxError: EOL while scanning string literal". It does mention a string has an error. However, it's not always clear to the parser whether the opening or closing quote is missing. See 16 common Python runtime errors

Haydar Al-Rikabi
Haydar Al-Rikabi
5,971 Points

The link in Chris' comment is broken.

Please see 16 common Python runtime errors.