Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What Are Python Literals?
#11
(Sep-22-2020, 05:36 PM)Julie Wrote: What Are Python Literals?

Python literals are explained in documentation under The Python Language Reference > 6. Expressions > 6.2. Atoms > 6.2.2. Literals

Position of this document gives idea of literals 'place' in Python's taxonomy so if interested one can get broader picture including expressions, atoms, identifiers (names), literals, displays etc.

As for short definition have look at The Python Language Reference > 2. Lexical Analysis > 2.4 Literals:

Quote:Literals are notations for constant values of some built-in types.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#12
A literal in programming is a grammatical concept. It means data that appears literally in the program. I would say it is anything that the python tokener tokenize.tokenize() recognizes as a token.NUMBER or token.STRING.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  replace in code vs literals Skaperen 3 2,397 Mar-30-2021, 12:37 AM
Last Post: Skaperen
  string literals in a list. Not what I expected. tycarac 3 2,632 Dec-28-2019, 05:31 AM
Last Post: tycarac
  parenthesis around a tuple of literals in a for Skaperen 2 2,142 Aug-25-2019, 03:00 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020