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 S
By Guest on 13th November 2022 09:37:43 PM | Syntax: PYTHON | Views: 191



New Paste New paste | Download Paste Download | Toggle Line Numbers Show/Hide line no. | Copy Paste Copy text to clipboard
  1. Glossary - S
  2. ********
  3.  
  4. __slots__
  5.    A declaration inside a class that saves memory by pre-declaring
  6.    space for instance attributes and eliminating instance
  7.    dictionaries.  Though popular, the technique is somewhat tricky to
  8.    get right and is best reserved for rare cases where there are large
  9.    numbers of instances in a memory-critical application.
  10.  
  11. sequence
  12.    An *iterable* which supports efficient element access using integer
  13.    indices via the "__getitem__()" special method and defines a
  14.    "__len__()" method that returns the length of the sequence. Some
  15.    built-in sequence types are "list", "str", "tuple", and "bytes".
  16.    Note that "dict" also supports "__getitem__()" and "__len__()", but
  17.    is considered a mapping rather than a sequence because the lookups
  18.    use arbitrary *immutable* keys rather than integers.
  19.  
  20.    The "collections.abc.Sequence" abstract base class defines a much
  21.    richer interface that goes beyond just "__getitem__()" and
  22.    "__len__()", adding "count()", "index()", "__contains__()", and
  23.    "__reversed__()". Types that implement this expanded interface can
  24.    be registered explicitly using "register()".
  25.  
  26. set comprehension
  27.    A compact way to process all or part of the elements in an iterable
  28.    and return a set with the results. "results = {c for c in
  29.   'abracadabra' if c not in 'abc'}" generates the set of strings
  30.    "{'r', 'd'}".  See Displays for lists, sets and dictionaries.
  31.  
  32. single dispatch
  33.    A form of *generic function* dispatch where the implementation is
  34.    chosen based on the type of a single argument.
  35.  
  36. slice
  37.    An object usually containing a portion of a *sequence*.  A slice is
  38.    created using the subscript notation, "[]" with colons between
  39.    numbers when several are given, such as in "variable_name[1:3:5]".
  40.    The bracket (subscript) notation uses "slice" objects internally.
  41.  
  42. special method
  43.    A method that is called implicitly by Python to execute a certain
  44.    operation on a type, such as addition.  Such methods have names
  45.    starting and ending with double underscores.  Special methods are
  46.    documented in Special method names.
  47.  
  48. statement
  49.    A statement is part of a suite (a "block" of code).  A statement is
  50.    either an *expression* or one of several constructs with a keyword,
  51.    such as "if", "while" or "for".
  52.  
  53. strong reference
  54.    In Python's C API, a strong reference is a reference to an object
  55.   which increments the object's reference count when it is created
  56.    and decrements the object's reference count when it is deleted.
  57.  
  58.   The "Py_NewRef()" function can be used to create a strong reference
  59.   to an object. Usually, the "Py_DECREF()" function must be called on
  60.   the strong reference before exiting the scope of the strong
  61.   reference, to avoid leaking one reference.
  62.  
  63.   See also *borrowed reference*.
  64.  
  65.  
  66.  
  67. Python Slice Notation Tutorial - How to Slice Strings and Lists Explained with Examples (+ Reverse)
















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