Beginner Flashcards
(167 cards)
What is the default Python prompt of the interactive shell?
The default Python prompt is often seen for code examples which can be executed interactively in the interpreter.
What does an abstract base class (ABC) provide in Python?
ABCs provide a way to define interfaces and introduce virtual subclasses recognized by isinstance() and issubclass().
What is an annotation in Python?
A label associated with a variable, class attribute, or function parameter or return value, used as a type hint.
What are the two kinds of arguments in Python?
- Keyword argument
- Positional argument
What is an asynchronous context manager?
An object which controls the environment seen in an async with statement by defining __aenter__() and __aexit__() methods.
What is an asynchronous generator?
A function which returns an asynchronous generator iterator, defined with async def and containing yield expressions.
What is an asynchronous iterable?
An object that can be used in an async for statement and must return an asynchronous iterator from its __aiter__() method.
What is a callable in Python?
An object that can be called, possibly with a set of arguments, including functions, methods, and instances of classes with __call__().
What is the role of a callback in programming?
A subroutine function passed as an argument to be executed at some point in the future.
What is a class in Python?
A template for creating user-defined objects, typically containing method definitions.
What is a closure variable?
A free variable referenced from a nested scope that is defined in an outer scope.
What defines a complex number in Python?
A number expressed as a sum of a real part and an imaginary part, written with a j suffix, e.g., 3+1j.
What is a context manager?
An object that implements the context management protocol and controls the environment seen in a with statement.
What does the term ‘contiguous’ refer to in Python?
A buffer is considered contiguous if it is either C-contiguous or Fortran contiguous.
What is a coroutine?
A more generalized form of subroutines that can be entered, exited, and resumed at many different points.
What is the purpose of decorators in Python?
Functions that return another function, usually applied as a transformation using the @wrapper syntax.
What is a dictionary in Python?
An associative array where arbitrary keys are mapped to values, with keys being any object with __hash__() and __eq__().
What is a dictionary comprehension?
A compact way to process elements in an iterable and return a dictionary with the results.
What is a docstring?
A string literal that appears as the first expression in a class, function, or module, used for documentation.
What is duck-typing?
A programming style that emphasizes interfaces rather than specific types, allowing polymorphic substitution.
What does EAFP stand for?
Easier to ask for forgiveness than permission.
Fill in the blank: An _______ is an accumulation of expression elements that returns a value.
expression
What is an extension module?
A module written in C or C++, using Python’s C API to interact with the core and with user code.
What are f-strings in Python?
String literals prefixed with ‘f’ or ‘F’, known as formatted string literals.