The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Python Glossary: terms starting with letter T
By Guest on 13th November 2022 09:39:43 PM | Syntax: PYTHON | Views: 207



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - T
  2. ********
  3.  
  4. text encoding
  5.    A string in Python is a sequence of Unicode code points (in range
  6.    "U+0000"--"U+10FFFF"). To store or transfer a string, it needs to
  7.    be serialized as a sequence of bytes.
  8.  
  9.    Serializing a string into a sequence of bytes is known as
  10.    "encoding", and recreating the string from the sequence of bytes is
  11.    known as "decoding".
  12.  
  13.    There are a variety of different text serialization codecs, which
  14.    are collectively referred to as "text encodings".
  15.  
  16. text file
  17.    A *file object* able to read and write "str" objects. Often, a text
  18.    file actually accesses a byte-oriented datastream and handles the
  19.    *text encoding* automatically. Examples of text files are files
  20.    opened in text mode ("'r'" or "'w'"), "sys.stdin", "sys.stdout",
  21.    and instances of "io.StringIO".
  22.  
  23.    See also *binary file* for a file object able to read and write
  24.    *bytes-like objects*.
  25.  
  26. triple-quoted string
  27.    A string which is bound by three instances of either a quotation
  28.    mark (") or an apostrophe (').  While they don't provide any
  29.   functionality not available with single-quoted strings, they are
  30.   useful for a number of reasons.  They allow you to include
  31.   unescaped single and double quotes within a string and they can
  32.   span multiple lines without the use of the continuation character,
  33.   making them especially useful when writing docstrings.
  34.  
  35. type
  36.   The type of a Python object determines what kind of object it is;
  37.   every object has a type.  An object's type is accessible as its
  38.   "__class__" attribute or can be retrieved with "type(obj)".
  39.  
  40. type alias
  41.   A synonym for a type, created by assigning the type to an
  42.   identifier.
  43.  
  44.   Type aliases are useful for simplifying *type hints*. For example:
  45.  
  46.      def remove_gray_shades(
  47.              colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:
  48.          pass
  49.  
  50.   could be made more readable like this:
  51.  
  52.      Color = tuple[int, int, int]
  53.  
  54.      def remove_gray_shades(colors: list[Color]) -> list[Color]:
  55.          pass
  56.  
  57.   See "typing" and **PEP 484**, which describe this functionality.
  58.  
  59. type hint
  60.   An *annotation* that specifies the expected type for a variable, a
  61.   class attribute, or a function parameter or return value.
  62.  
  63.   Type hints are optional and are not enforced by Python but they are
  64.   useful to static type analysis tools, and aid IDEs with code
  65.   completion and refactoring.
  66.  
  67.   Type hints of global variables, class attributes, and functions,
  68.   but not local variables, can be accessed using
  69.   "typing.get_type_hints()".
  70.  
  71.   See "typing" and **PEP 484**, which describe this functionality.
  72.  
  73.  
  74.  
  75.  
  76. Beginner Python3: Encoding and Decoding
















Python software and documentation are licensed under the PSF License Agreement.
Starting with Python 3.8.6, examples, recipes, and other code in the documentation are dual licensed under the PSF License Agreement and the Zero-Clause BSD license.
Some software incorporated into Python is under different licenses. The licenses are listed with code falling under that license. See Licenses and Acknowledgements for Incorporated Software for an incomplete list of these licenses.

Python and it's documentation is:
Copyright © 2001-2022 Python Software Foundation. All rights reserved.
Copyright © 2000 BeOpen.com. All rights reserved.
Copyright © 1995-2000 Corporation for National Research Initiatives. All rights reserved.
Copyright © 1991-1995 Stichting Mathematisch Centrum. All rights reserved.

See History and License for complete license and permissions information:
https://docs.python.org/3/license.html#psf-license
  • Recent Pastes