Justin
Justin

Reputation: 1479

What is the keyword "license" used for in python?

I just went to use "license" as a variable name and it became highlighted to indicate that it was a reserved word, what is "license" used for?

Upvotes: 10

Views: 5308

Answers (3)

Martijn Pieters
Martijn Pieters

Reputation: 1123560

license is one of the built-in constants added by the site module.

It's use is entirely within the interactive interpreter:

>>> license
See http://www.python.org/2.7/license.html

Other such objects are credits and copyright, plus the quit() and exit() functions.

If you are curious as to its implementation, see the setcopyright() function source.

Upvotes: 6

Christian Tapia
Christian Tapia

Reputation: 34166

It's not a keyword, it's a constant added by the site module (some others are copyright and credits). If you want to know what it does, try:

print license
>>> Type license() to see the full license text

then if you type

license()

output will be:

A. HISTORY OF THE SOFTWARE

Python was created in the early 1990s by Guido van Rossum at Stichting Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands as a successor of a language called ABC. Guido remains Python's principal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation for National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) in Reston, Virginia where he released several versions of the software.

In May 2000, Guido and the Python core development team moved to BeOpen.com to form the BeOpen PythonLabs team. In October of the same year, the PythonLabs team moved to Digital Creations (now Zope Corporation, see http://www.zope.com). In 2001, the Python Software Foundation (PSF, see http://www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related Intellectual Property. Zope Corporation is a sponsoring member of the PSF.

All Python releases are Open Source (see http://www.opensource.org for Hit Return for more, or q (and Return) to quit:

Upvotes: 14

Amber
Amber

Reputation: 527133

It's not a reserved word in Python: http://docs.python.org/2/reference/lexical_analysis.html#keywords

It's a built-in function; try running it in an interactive shell:

Python 2.7.3 (default, Sep 26 2013, 20:03:06)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> license
Type license() to see the full license text
>>> license()
A. HISTORY OF THE SOFTWARE
==========================

Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
as a successor of a language called ABC.  Guido remains Python's
principal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
in Reston, Virginia where he released several versions of the
software.

In May 2000, Guido and the Python core development team moved to
BeOpen.com to form the BeOpen PythonLabs team.  In October of the same
year, the PythonLabs team moved to Digital Creations (now Zope
Corporation, see http://www.zope.com).  In 2001, the Python Software
Foundation (PSF, see http://www.python.org/psf/) was formed, a
non-profit organization created specifically to own Python-related
Intellectual Property.  Zope Corporation is a sponsoring member of
the PSF.

All Python releases are Open Source (see http://www.opensource.org for
Hit Return for more, or q (and Return) to quit:

Upvotes: 0

Related Questions