On Thu, Aug 10, 2017 at 09:39:02AM -0400, C W wrote:

> What's a literal? The only other time I heard about it was studying
> Shakespare. ;)

A "literal" is syntax that creates a value, without the programmer 
needing to call a function. The syntax stands for the LITERAL value as 

For example, we write:

    number = 123  # stands for literally 123

rather than:

    number = int(hundreds=1, tens=2, units=3)

Examples of literals:

"Hello World!"  # a string
1.234  # a float
999  # an int
True  # bool true value
None  # the special None value

Technically, these aren't literals, but they're the moral equivalent of 

[1, 2, None, "Hello", 23]  # a list
(1, 2, 3)  # a tuple
{'key': 'value'}  # a dict

> I don't know what literal is. So, it won't help me to understand ellipsis,
> I really thought it was that oval shaped figure.

Ellipsis \El*lip"sis\ ([e^]l*l[i^]p"s[i^]s), n.; pl. Ellipses

      (Gram.) Omission; a figure of syntax, by which one or more
      words, which are obviously understood, are omitted; as,
      the virtues I admire, for, the virtues which I admire.
      [1913 Webster]

      (Printing) a printing symbol, usually three periods in a
      row (. . .), indicating the omission of some part of a
      text; -- used commonly in quotations, so as to suppress
      words not essential to the meaning. A long dash (---) and
      three asterisks (* * *) are sometimes used with the same

There's also an older (now obsolete) meaning of "ellipsis" as a synonym 
for "ellipse", which is an oval-shaped figure.

> Wiki says: "Literals are often used to initialize variables"

As in:

n = 0
x = 1.5

Outside of numpy, I've never seen anyone use Ellipsis (whether spelled 
by name or by three dots) except to be cute. I'm sure it has use to some 
people, otherwise it wouldn't have been added, but its pretty 

Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:

Reply via email to