Text stringlengths 1 9.41k |
|---|
Such a parameter can be defined
by prepending the parameter name with **, for example kwargs in the example above.
Parameters can specify both optional and required arguments, as well as default values for some
optional arguments.
-----
See also the argument glossary entry, the FAQ question on the difference betwee... |
a path entry hook) which knows**
how to locate modules given a path entry.
See importlib.abc.PathEntryFinder for the methods that path entry finders implement.
**path entry hook A callable on the sys.path_hook list which returns a path entry finder if it knows how**
to find modules on a specific path entry.
**path b... |
A path-like object is either a str or bytes**
object representing a path, or an object implementing the os.PathLike protocol. |
An object that
supports the os.PathLike protocol can be converted to a str or bytes file system path by calling the
```
os.fspath() function; os.fsdecode() and os.fsencode() can be used to guarantee a str or bytes
```
[result instead, respectively. |
Introduced by PEP 519.](https://www.python.org/dev/peps/pep-0519)
**PEP Python Enhancement Proposal. |
A PEP is a design document providing information to the Python**
community, or describing a new feature for Python or its processes or environment. |
PEPs should
provide a concise technical specification and a rationale for proposed features.
PEPs are intended to be the primary mechanisms for proposing major new features, for collecting community input on an issue, and for documenting the design decisions that have gone into Python. |
The
PEP author is responsible for building consensus within the community and documenting dissenting
opinions.
[See PEP 1.](https://www.python.org/dev/peps/pep-0001)
**portion A set of files in a single directory (possibly stored in a zip file) that contribute to a namespace**
[package, as defined in PEP 420.](https:... |
While major changes to such interfaces are not expected, as long
as they are marked provisional, backwards incompatible changes (up to and including removal of
the interface) may occur if deemed necessary by core developers. |
Such changes will not be made
gratuitously – they will occur only if serious fundamental flaws are uncovered that were missed prior
to the inclusion of the API.
Even for provisional APIs, backwards incompatible changes are seen as a “solution of last resort” every attempt will still be made to find a backwards compati... |
See PEP 411 for more details.](https://www.python.org/dev/peps/pep-0411)
**provisional package See provisional API** .
**Python 3000 Nickname for the Python 3.x release line (coined long ago when the release of version 3 was**
something in the distant future.) This is also abbreviated “Py3k”.
**Pythonic An idea or p... |
For example, a common
idiom in Python is to loop over all elements of an iterable using a for statement. |
Many other languages
don’t have this type of construct, so people unfamiliar with Python sometimes use a numerical counter
instead:
-----
As opposed to the cleaner, Pythonic method:
```
for piece in food:
print(piece)
```
**qualified name A dotted name showing the “path” from a module’s global scope to a cl... |
For top-level functions and classes, the](https://www.python.org/dev/peps/pep-3155)
qualified name is the same as the object’s name:
```
>>> class C:
... class D:
... def meth(self):
... |
pass
...
>>> C.__qualname__
'C'
>>> C.D.__qualname__
'C.D'
>>> C.D.meth.__qualname__
'C.D.meth'
```
When used to refer to modules, the fully qualified name means the entire dotted path to the module,
including any parent packages, e.g. |
email.mime.text:
```
>>> import email.mime.text
>>> email.mime.text.__name__
'email.mime.text'
```
**reference count The number of references to an object. |
When the reference count of an object drops to**
zero, it is deallocated. Reference counting is generally not visible to Python code, but it is a key element
of the CPython implementation. |
The sys module defines a getrefcount() function that programmers
can call to return the reference count for a particular object.
**regular package A traditional package, such as a directory containing an __init__.py file.**
See also namespace package.
**__slots__ A declaration inside a class that saves memory by pre... |
Though popular, the technique is somewhat tricky to get right
and is best reserved for rare cases where there are large numbers of instances in a memory-critical
application.
**sequence An iterable which supports efficient element access using integer indices via the __getitem__()**
special method and defines a __len_... |
Some built-in
sequence types are list, str, tuple, and bytes. |
Note that dict also supports __getitem__() and
```
__len__(), but is considered a mapping rather than a sequence because the lookups use arbitrary
```
_immutable keys rather than integers._
The collections.abc.Sequence abstract base class defines a much richer interface that goes
beyond just __getitem__() and __le... |
Types that implement this expanded interface can be registered explicitly using
register().
```
**single dispatch A form of generic function dispatch where the implementation is chosen based on the type**
of a single argument.
**slice An object usually containing a portion of a sequence. |
A slice is created using the subscript notation, []**
with colons between numbers when several are given, such as in variable_name[1:3:5]. |
The bracket
(subscript) notation uses slice objects internally.
-----
**special method A method that is called implicitly by Python to execute a certain operation on a type,**
such as addition. |
Such methods have names starting and ending with double underscores. Special
methods are documented in specialnames.
**statement A statement is part of a suite (a “block” of code). |
A statement is either an expression or one of**
several constructs with a keyword, such as if, while or for.
**struct sequence A tuple with named elements. |
Struct sequences expose an interface similar to named**
_tuple in that elements can either be accessed either by index or as an attribute. |
However, they do_
not have any of the named tuple methods like _make() or _asdict(). |
Examples of struct sequences
include sys.float_info and the return value of os.stat().
**text encoding A codec which encodes Unicode strings to bytes.**
**text file A file object able to read and write str objects. |
Often, a text file actually accesses a byte-oriented**
datastream and handles the text encoding automatically. |
Examples of text files are files opened in text
mode ('r' or 'w'), sys.stdin, sys.stdout, and instances of io.StringIO.
See also binary file for a file object able to read and write bytes-like objects.
**triple-quoted string A string which is bound by three instances of either a quotation mark (“) or an**
apostrophe ... |
While they don’t provide any functionality not available with single-quoted strings,
they are useful for a number of reasons. |
They allow you to include unescaped single and double quotes
within a string and they can span multiple lines without the use of the continuation character, making
them especially useful when writing docstrings.
**type The type of a Python object determines what kind of object it is; every object has a type. |
An object’s**
type is accessible as its __class__ attribute or can be retrieved with type(obj).
**type alias A synonym for a type, created by assigning the type to an identifier.**
Type aliases are useful for simplifying type hints. |
For example:
```
from typing import List, Tuple
def remove_gray_shades(
colors: List[Tuple[int, int, int]]) -> List[Tuple[int, int, int]]:
pass
```
could be made more readable like this:
```
from typing import List, Tuple
Color = Tuple[int, int, int]
def remove_gray_shades(colors: List[Color... |
See PEP 278 and PEP 3116, as well as bytes.splitlines() for an](https://www.python.org/dev/peps/pep-0278)
additional use.
**variable annotation An annotation of a variable or a class attribute.**
When annotating a variable or a class attribute, assignment is optional:
```
class C:
field: 'annotation'
```
Var... |
Python’s virtual machine executes the bytecode**
emitted by the bytecode compiler.
**Zen of Python Listing of Python design principles and philosophies that are helpful in understanding and**
using the language. |
The listing can be found by typing “import this” at the interactive prompt.
-----
-----
**APPENDIX**
### B
ABOUT THESE DOCUMENTS
[These documents are generated from reStructuredText sources by Sphinx, a document processor specifically](http://docutils.sourceforge.net/rst.html)
written for the Python documentati... |
If
you want to contribute, please take a look at the reporting-bugs page for information on how to do so. New
volunteers are always welcome!
Many thanks go to:
- Fred L. |
Drake, Jr., the creator of the original Python documentation toolset and writer of much of the
content;
[• the Docutils project for creating reStructuredText and the Docutils suite;](http://docutils.sourceforge.net/)
[• Fredrik Lundh for his Alternative Python Reference project from which Sphinx got many good ideas.]... |
See Misc/ACKS in the Python source distribution for a partial list of contributors.](https://github.com/python/cpython/tree/3.7/Misc/ACKS)
It is only with the input and contributions of the Python community that Python has such wonderful
documentation – Thank You!
-----
-----
**APPENDIX**
### C
HISTORY AND LICE... |
Guido remains Python’s](https://www.cwi.nl/)
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 https://www.cnri.reston.va.us/) in Reston, Virginia where he released several versions of the ... |
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 https:](http://www.zope.com/)
[//www.python.org/psf/) was formed, a non-profit organization created specifically to own Python-related](https://www.python.org/psf/)
Intellectual Property. |
Zope Corporation is a sponsoring member of the PSF.
[All Python releases are Open Source (see https://opensource.org/ for the Open Source Definition). |
Histor-](https://opensource.org/)
ically, most, but not all, Python releases have also been GPL-compatible; the table below summarizes the
various releases.
Release Derived from Year Owner GPL compatible?
0.9.0 thru 1.2 n/a 1991-1995 CWI yes
1.3 thru 1.5.2 1.2 1995-1999 CNRI yes
1.6 1.5.2 2000 CNRI no
2.0 1.6 2000... |
All Python licenses,
unlike the GPL, let you distribute a modified version without making your changes open source. |
The GPLcompatible licenses make it possible to combine Python with other software that is released under the GPL;
the others don’t.
Thanks to the many outside volunteers who have worked under Guido’s direction to make these releases
possible.
|Release|Derived from|Year|Owner|GPL compatible?|
|---|---|---|---|---|
|0.... |
This LICENSE AGREEMENT is between the Python Software Foundation ("PSF"), and
the Individual or Organization ("Licensee") accessing and otherwise using Python
3.7.0 software in source or binary form and its associated documentation.
2. |
Subject to the terms and conditions of this License Agreement, PSF hereby
grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce,
analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python 3.7.0 alone or in any derivative
version, provid... |
In the event Licensee prepares a derivative work that is based on or
incorporates Python 3.7.0 or any part thereof, and wants to make the
derivative work available to others as provided herein, then Licensee hereby
agrees to include in any such work a brief summary of the changes made to Python
3.7.0.
4. |
PSF is making Python 3.7.0 available to Licensee on an "AS IS" basis.
PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. |
BY WAY OF
EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE
USE OF PYTHON 3.7.0 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. |
PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 3.7.0
FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 3.7.0, OR ANY DERIVATIVE
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. |
This License Agreement will automatically terminate upon a material breach of
its terms and conditions.
7. |
Nothing in this License Agreement shall be deemed to create any relationship
of agency, partnership, or joint venture between PSF and Licensee. |
This License
Agreement does not grant permission to use PSF trademarks or trade name in a
trademark sense to endorse or promote products or services of Licensee, or any
third party.
8. |
By copying, installing or otherwise using Python 3.7.0, Licensee agrees
to be bound by the terms and conditions of this License Agreement.
C.2.2 BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0
```
BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1
```
1. |
This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an office at
160 Saratoga Avenue, Santa Clara, CA 95051, and the Individual or Organization
```
(continues on next page)
-----
#### C.2.3 CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1
(continued from previous page)
```
BY WAY OF
This License
```
(contin... |
This Agreement together with Python 1.6.1 may be located on the
Internet using the following unique, persistent identifier (known as a handle):
1895.22/1013. |
This Agreement may also be obtained from a proxy server on the
Internet using the following URL: http://hdl.handle.net/1895.22/1013."
3. |
In the event Licensee prepares a derivative work that is based on or
incorporates Python 1.6.1 or any part thereof, and wants to make the derivative
work available to others as provided herein, then Licensee hereby agrees to
include in any such work a brief summary of the changes made to Python 1.6.1.
4. |
CNRI is making Python 1.6.1 available to Licensee on an "AS IS" basis. CNRI
MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. |
BY WAY OF EXAMPLE,
BUT NOT LIMITATION, CNRI MAKES NO AND DISCLAIMS ANY REPRESENTATION OR WARRANTY
OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF
PYTHON 1.6.1 WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
5. |
CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON 1.6.1 FOR
ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS A RESULT OF
MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, OR ANY DERIVATIVE
THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF.
6. |
This License Agreement will automatically terminate upon a material breach of
its terms and conditions.
7. |
This License Agreement shall be governed by the federal intellectual property
law of the United States, including without limitation the federal copyright
law, and, to the extent such U.S. |
federal law does not apply, by the law of the
Commonwealth of Virginia, excluding Virginia's conflict of law provisions.
Notwithstanding the foregoing, with regard to derivative works based on Python
1.6.1 that incorporate non-separable material that was previously distributed
under the GNU General Public Licen... |
Nothing in
this License Agreement shall be deemed to create any relationship of agency,
partnership, or joint venture between CNRI and Licensee. |
This License Agreement
does not grant permission to use CNRI trademarks or trade name in a trademark
sense to endorse or promote products or services of Licensee, or any third
party.
8. |
By clicking on the "ACCEPT" button where indicated, or by copying, installing
or otherwise using Python 1.6.1, Licensee agrees to be bound by the terms and
conditions of this License Agreement.
#### C.2.4 CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2
Copyright © 1991 - 1995, Stichting Mathematisch Centrum Ams... |
All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted, provided that
the above copyright notice appear in all copies and that both that copyright
notice and this permission notice appear in supporting documentation, and... |
The following are the verbatim comments from the original code:](http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html)
```
A C-program for MT19937, with initialization improved 2002/1/26.
Coded by Takuji Nishimura and Makoto Matsumoto.
Before using, initialize the state by using init_genrand(seed)
or ... |
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. |
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. |
The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES ... |
IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIA... |
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. |
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. |
Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,... |
IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ... |
This results in a 1000-fold speedup. |
The C
version is still 5 times faster, though.
- Arguments more compliant with Python standard
#### C.3.7 XML Remote Procedure Calls
```
The xmlrpc.client module contains the following notice:
(continued from previous page)
(continues on next page)
-----
#### C.3.8 test_epoll
The test_epoll module contains th... |
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#### C.3.9 Select kqueue
```
The select module contains the... |
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. |
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDI... |
IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, W... |
The contains the following note:
```
<MIT License>
Copyright (c) 2013 Marek Majkowski <marek@popcount.org>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without lim... |
Gay, currently available from http:](http://www.netlib.org/fp/)
[//www.netlib.org/fp/. |
The original file, as retrieved on March 16, 2009, contains the following copyright](http://www.netlib.org/fp/)
and licensing notice:
-----
#### C.3.12 OpenSSL
The modules hashlib, posix, ssl, crypt use the OpenSSL library for added performance if made available
by the operating system. |
Additionally, the Windows and Mac OS X installers for Python may include a
copy of the OpenSSL libraries, so we include a copy of the OpenSSL license here:
```
LICENSE ISSUES
==============
The OpenSSL toolkit stays under a dual license, i.e. |
both the conditions of
the OpenSSL License and the original SSLeay license apply to the toolkit.
See below for the actual license texts. Actually both licenses are BSD-style
Open Source licenses. |
In case of any license issues related to OpenSSL
please contact openssl-core@openssl.org.
OpenSSL License
-------------- /* ====================================================================
* Copyright (c) 1998-2008 The OpenSSL Project. |
All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. |
Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. |
Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. |
All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the OpenSSL Project
* for use in the OpenSSL Toolkit. |
(http://www.openssl.org/)"
```
(continues on next page)
-----
(continued from previous page)
(continues on next page)
-----
(continued from previous page)
```
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redist... |
Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. |
Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.