Perhaps one of the most important structures of the Python object system is the structure that defines a new type: the PyTypeObject structure. Type objects can be handled using any of the PyObject_...| Python documentation
CPython supports two different calling protocols: tp_call and vectorcall. The tp_call Protocol: Instances of classes that set tp_call are callable. The signature of the slot is: A call is made usin...| Python documentation
Source code: Lib/runpy.py The runpy module is used to locate and run Python modules without importing them first. Its main use is to implement the-m command line switch that allows scripts to be lo...| Python documentation
In this tutorial, you'll learn the difference between the string representations returned by .__repr__() vs .__str__() and understand how to use them effectively in classes that you define.| realpython.com
Source code: Lib/pkgutil.py This module provides utilities for the import system, in particular package support.| Python documentation
In Python, all exceptions must be instances of a class that derives from BaseException. In a try statement with an except clause that mentions a particular class, that clause also handles any excep...| Python documentation
Source code: Lib/bisect.py This module provides support for maintaining a list in sorted order without having to sort the list after each insertion. For long lists of items with expensive compariso...| Python documentation
Source code: Lib/weakref.py The weakref module allows the Python programmer to create weak references to objects. In the following, the term referent means the object which is referred to by a weak...| Python documentation
An explanation of all of Python's 100+ dunder methods and 50+ dunder attributes, including a summary of each one.| www.pythonmorsels.com
In this tutorial, you'll learn what magic methods are in Python, how they work, and how to use them in your custom classes to support powerful features in your object-oriented code.| realpython.com
Error codes enabled by default¶| mypy.readthedocs.io
Creating Heap-Allocated Types: The following functions and structs are used to create heap types.| Python documentation
The functions and macros in this section are used for managing reference counts of Python objects.| Python documentation
Source code: Lib/operator.py The operator module exports a set of efficient functions corresponding to the intrinsic operators of Python. For example, operator.add(x, y) is equivalent to the expres...| Python documentation
In this tutorial, you'll learn how class constructors work in Python. You'll also explore Python's instantiation process, which has two main steps: instance creation and instance initialization.| realpython.com
This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides acc...| Python documentation
Starting with the 3.13 release, CPython has experimental support for a build of Python called free threading where the global interpreter lock(GIL) is disabled. Free-threaded execution allows for f...| Python documentation
Source code: Lib/email/message.py The central class in the email package is the EmailMessage class, imported from the email.message module. It is the base class for the email object model. EmailMes...| Python documentation
Python's built-in functions list includes 71 functions now! Which built-in functions are worth knowing about? And which functions should you learn later?| www.pythonmorsels.com
Source code: Lib/traceback.py This module provides a standard interface to extract, format and print stack traces of Python programs. It is more flexible than the interpreter’s default traceback di...| Python documentation
Deciphering Glyph, the blog of Glyph Lefkowitz.| blog.glyph.im
BrowserContexts provide a way to operate multiple independent browser sessions.| playwright.dev
Source code: Lib/numbers.py The numbers module ( PEP 3141) defines a hierarchy of numeric abstract base classes which progressively define more operations. None of the types defined in this module ...| Python documentation
The Message class is very similar to the EmailMessage class, without the methods added by that class, and with the default behavior of certain other methods being slightly different. We also docume...| Python documentation
This section outlines high-level asyncio APIs to work with coroutines and Tasks. Coroutines, Awaitables, Creating Tasks, Task Cancellation, Task Groups, Sleeping, Running Tasks Concurrently, Eager ...| Python documentation
We are starting to work on a new product, coq-of-python. The idea of this tool is, as you can guess, to translate Python code to the proof system Coq.| formal.land
Assert that two numbers (or two ordered sequences of numbers) are equal to each other| docs.pytest.org
Intro to the WebSocket protocol, web3.py's WebSocketProvider, and subscriptions (eth_subscribe) in Python.| Snake Charmers
Mark functions as async. Call them with await. All of a sudden, your program becomes asynchronous – it can do useful things while it waits for...| tenthousandmeters.com
Author, Guido van Rossum,. This article explains the new features in Python 3.0, compared to 2.6. Python 3.0, also known as “Python 3000” or “Py3K”, is the first ever intentionally backwards incomp...| Python documentation
Source code: Lib/importlib/metadata/__init__.py importlib.metadata is a library that provides access to the metadata of an installed Distribution Package, such as its entry points or its top-level ...| Python documentation
Source code: Lib/types.py This module defines utility functions to assist in dynamic creation of new types. It also defines names for some object types that are used by the standard Python interpre...| Python documentation
Source code: Lib/dis.py The dis module supports the analysis of CPython bytecode by disassembling it. The CPython bytecode which this module takes as an input is defined in the file Include/opcode....| Python documentation
Why not…¶| www.attrs.org
No errors reported for obviously wrong code¶| mypy.readthedocs.io
Python objects are synchronous by default. When working with asyncio if we create an object the __init__ is a regular function and we cannot do any async work in here.| jacobtomlinson.dev
This is the second post in my series on the inner workings of attrs. The series starts here. Out of the box, attrs can customize your classes in two different, orthogonal ways - make your class a slot class (instead of a normal Python class, which for simplicity's sake we'll| The Three of Wands
How to sort parent nodes before child nodes? - Topological sort| www.cameronmacleod.com
An Enum is a set of symbolic names bound to unique values. They are similar to global variables, but they offer a more useful repr(), grouping, type-safety, and a few other features. They are most ...| Python documentation
Function overloading¶| mypy.readthedocs.io
In this tutorial, you'll learn a few Python naming conventions involving single and double underscores (_). You'll learn how to use this character to differentiate between public and non-public names in APIs, write safe classes for subclassing purposes, avoid name clashes, and more.| realpython.com
By playing with the Python AST we can add functionality with making the user write any extra code. You may use this power for good or evil.| Tinkering
Source code: Lib/inspect.py The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, ...| Python documentation
I’m a software engineer based in Edinburgh, Scotland. My interests include getting computers to behave, helping other people get computers to behave, open source, maths, and music.| harry.garrood.me
Deciphering Glyph, the blog of Glyph Lefkowitz.| glyph.twistedmatrix.com
Until now error messages haven’t been more than mentioned, but if you have tried out the examples you have probably seen some. There are (at least) two distinguishable kinds of errors: syntax error...| Python documentation
Source code: Lib/zoneinfo The zoneinfo module provides a concrete time zone implementation to support the IANA time zone database as originally specified in PEP 615. By default, zoneinfo uses the s...| Python documentation
Source code: Lib/_collections_abc.py This module provides abstract base classes that can be used to test whether a class provides a particular interface; for example, whether it is hashable or whet...| Python documentation
Page provides methods to interact with a single tab in a Browser], or an [extension background page in Chromium. One [Browser] instance might have multiple [Page] instances.| playwright.dev
The package fmt defines GoStringer interface, and I think it doesn’t have recognition it deserves. According to the documentation: GoStringer is implemented by any value that has a GoString method, which defines the Go syntax for that value. The GoString method is used to print values passed as an operand to a %#v format. That means that you can implement GoString() string method on any of your types, and it will be called when the object of this type is formatted using %#v.| blog.orsinium.dev
A small number of constants live in the built-in namespace. They are: Constants added by the site module: The site module (which is imported automatically during startup, except if the-S command-li...| Python documentation
Assert that two numbers (or two ordered sequences of numbers) are equal to each other| docs.pytest.org
Source code: Lib/signal.py This module provides mechanisms to use signal handlers in Python. General rules: The signal.signal() function allows defining custom handlers to be executed when a signal...| Python documentation
This module provides access to some variables used or maintained by the interpreter and to functions that interact strongly with the interpreter. It is always available. Unless explicitly noted oth...| Python documentation
Source code: Lib/abc.py This module provides the infrastructure for defining abstract base classes(ABCs) in Python, as outlined in PEP 3119; see the PEP for why this was added to Python. (See also ...| Python documentation
Editors, Elvis Pranskevichus < elvis@magic.io>, Yury Selivanov < yury@magic.io>,. This article explains the new features in Python 3.6, compared to 3.5. Python 3.6 was released on December 23, 2016...| Python documentation
Source code: Lib/typing.py This module provides runtime support for type hints. Consider the function below: The function surface_area_of_cube takes an argument expected to be an instance of float,...| Python documentation
Source code: Lib/dataclasses.py This module provides a decorator and functions for automatically adding generated special methods such as__init__() and__repr__() to user-defined classes. It was ori...| Python documentation
>>>, The default Python prompt of the interactive shell. Often seen for code examples which can be executed interactively in the interpreter.,,..., Can refer to:- The default Python prompt of the i...| Python documentation
Editor, Adam Turner,. This article explains the new features in Python 3.12, compared to 3.11. Python 3.12 was released on October 2, 2023. For full details, see the changelog. Summary – Release hi...| Python documentation
Source code: Lib/contextlib.py This module provides utilities for common tasks involving the with statement. For more information see also Context Manager Types and With Statement Context Managers....| Python documentation
Go's new proposed range over func grammar allows for Python-style context-managers.| Tamir Bahar
Author, Raymond Hettinger,, Contact,,. Contents: Descriptor Guide- Primer- Simple example: A descriptor that returns a constant, Dynamic lookups, Managed attributes, Customiz...| Python documentation
Author, Andrew Dalke and Raymond Hettinger,. Python lists have a built-in list.sort() method that modifies the list in-place. There is also a sorted() built-in function that builds a new sorted lis...| Python documentation
Modules are currently not directly callable. Classes can define a __call__ method that makes instance objects callable, but defining a similarly named function in the global module scope has no effect, and that function can only be called by importing o...| Python Enhancement Proposals (PEPs)
Source code: Lib/logging/__init__.py Important: This page contains the API reference information. For tutorial information and discussion of more advanced topics, see Basic Tutorial, Advanced Tutor...| Python documentation
A simple statement is comprised within a single logical line. Several simple statements may occur on a single line separated by semicolons. The syntax for simple statements is: Expression statement...| Python documentation
Protocols and structural subtyping¶| mypy.readthedocs.io
Rewriting library code to speed up my interpreter benchmark by 28%.| healeycodes.com
This module provides access to the mathematical functions defined by the C standard. These functions cannot be used with complex numbers; use the functions of the same name from the cmath module if...| Python documentation
Source code: Lib/functools.py The functools module is for higher-order functions: functions that act on or return other functions. In general, any callable object can be treated as a function for t...| Python documentation
The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order.,,,, Built-in Functions,,, A, abs(), aiter(), all(), a...| Python documentation
Source code: Lib/struct.py This module converts between Python values and C structs represented as Python bytes objects. Compact format strings describe the intended conversions to/from Python valu...| Python documentation
A comparison of programming idioms for doing cleanup work| blog.gnoack.org
Source code: Lib/unittest/__init__.py(If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert methods.) The unittest unit testing framework was ...| Python documentation
Editor, Pablo Galindo Salgado,. This article explains the new features in Python 3.11, compared to 3.10. Python 3.11 was released on October 24, 2022. For full details, see the changelog. Summary –...| Python documentation
Most Python programmers don’t spend a lot of time thinking about how equality and hashing works. It usually just works. However there’s quite a bit of gotchas and edge cases that can lead to subtle and frustrating bugs once one starts to customize their behavior – especially if the rules on how they interact aren’t understood.| Hynek Schlawack
PEP 661 proposes adding a utility for defining sentinel values in the Python standard library. In this article, you'll get a PEP 661 summary, learn what sentinel objects are (with real-world examples), how to use them with type hints, and a bit about why PEPs exist in the first place.| death and gravity