Though easy and elegant to use, Python f-strings can be vulnerable to injection attacks when used to construct shell commands, SQL queries, HTML snippets and similar (for example, os.system(f"echo {message_from_user}")). This PEP introduces template lit...| Python Enhancement Proposals (PEPs)
autogen_core.models#| microsoft.github.io
Bases: Protocol| microsoft.github.io
autogen_agentchat.messages#| microsoft.github.io
autogen_agentchat.base#| microsoft.github.io
Bases: ChatAgent, ABC, ComponentBase[BaseModel]| microsoft.github.io
shape (required)Tuple whose elements are the array size in each dimension. Each| numpy.org
When you're working with named arguments (a.k.a. keyword arguments) it's the argument name that matters. When you're working with positional arguments, it's the position matters (but not the name).| www.pythonmorsels.com
Operators| amaranth-lang.org
Last time, we built a hybrid concurrent.futures executor using inheritance. Today, we're building it again (twice!) using composition and functions only, to figure out which way is better and why. Consider this a worked example.| death and gravity
Gallery examples: Scalable learning with polynomial kernel approximation Compare the effect of different scalers on data with outliers Clustering text documents using k-means| scikit-learn
Bases: _Weakrefable| arrow.apache.org
Dynamically typed code¶| mypy.readthedocs.io
Security considerations when using Loguru| loguru.readthedocs.io
Add a handler sending log messages to a sink adequately configured.| loguru.readthedocs.io
If you use Python's print() function to get information about the flow of your programs, then logging is the natural next step for you. This tutorial will guide you through creating your first logs and show you ways to curate them to grow with your projects.| realpython.com
Bases: BaseChatAgent, Component[MultimodalWebSurferConfig]| microsoft.github.io
Concurrency affects order| docs.scrapy.org
Feed exports| docs.scrapy.org
User directories¶| platformdirs.readthedocs.io
structlog Package: structlog.dev Module: Helpers that make development with structlog more pleasant. See also the narrative documentation in Console Output. structlog.testing Module: Helpers to tes...| structlog
Source code: Lib/email/generator.py One of the most common tasks is to generate the flat (serialized) version of the email message represented by a message object structure. You will need to do thi...| Python documentation
A high level console interface.| rich.readthedocs.io
Renders an auto-updating live display of any given renderable.| rich.readthedocs.io
Gallery examples: Release Highlights for scikit-learn 1.4 Visualizing cross-validation behavior in scikit-learn| scikit-learn
In this tutorial, you'll learn about functional programming in Python. You'll see what functional programming is, how it's supported in Python, and how you can use it in your Python code.| realpython.com
In this tutorial, you'll learn about the basic data types that are built into Python, including numbers, strings, bytes, and Booleans.| realpython.com
In this tutorial, you'll learn about the NoneType object None, which acts as the null in Python. This object represents emptiness, and you can use it to mark default parameters and even show when you have no result. None is a tool for doing everything with nothing!| realpython.com
This class implements a DBAPI-compliant interface. It is what the| www.psycopg.org
MP 132: It's a simple built-in function, but using it isn't as straightforward as it might seem. A task that's come up repeatedly in my programming work involves looking through a collection of values, and taking an action if a specific item appears anywhere in that collection. There's a way| Mostly Python
Gallery examples: Plot classification probability Decision Boundaries of Multinomial and One-vs-Rest Logistic Regression Multiclass sparse logistic regression on 20newgroups Multilabel classificati...| scikit-learn
The core component of Jinja is the Environment. It contains| jinja.palletsprojects.com
Dask futures reimplements the Python futures API so you can scale your Python futures workflow across a Dask cluster.| docs.dask.org
This glossary hopes to definitively represent the tacit and explicit conventions applied in Scikit-learn and its API, while providing a reference for users and contributors. It aims to describe the...| scikit-learn
This is a plain language guide to every built-in function in Python, paired with a simple example that shows each function in action.| Matt Layman
Gallery examples: Release Highlights for scikit-learn 1.5 Release Highlights for scikit-learn 1.4 Release Highlights for scikit-learn 1.2 Release Highlights for scikit-learn 1.1 Release Highlights ...| scikit-learn
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
Bases: _Tabular| arrow.apache.org
Understanding the core class design and usage via its evolution| zverok.space
A wrapper for sharding module parameters across data parallel workers.| pytorch.org
About The Project The video game hacking community is often a source of inspiration for those in the information security field. From in-depth memory hooking techniques to circumvent anti-cheat to beating the final boss via Cheat Engine scripts, there’s always something to learn that’s parallel to the challenges faced by those in the offensive or defensive field. The techniques discussed in this blog are analogous to methodologies used for malware analysis when dealing with custom packers.| Arch Cloud Labs
Good development practices for modern Python| www.stuartellis.name
Musical free association: “B after A” became “time to play B sides…“| Packy’s Place
Implement distributed data parallelism based on torch.distributed at module level.| pytorch.org
Model Choices Voyage currently provides the following text embedding models: Model Context Length (tokens) Embedding Dimension Description voyage-3-large 32,000 1024 (default), 256, 512, 2048 The best general-purpose and multilingual retrieval quality. See blog post for details. voyage-3 32,000 1024...| Voyage AI
Specifying and constructing data types#| numpy.org
Assert that two numbers (or two ordered sequences of numbers) are equal to each other| docs.pytest.org
Bringing a whole new meaning to "serverless".| Pyodide blog
Geocoders| geopy.readthedocs.io
Some code and tips to combine Python and Django introspection APIs to enforce naming conventions in your Django models.| Luke Plant's home page
Source code: Lib/calendar.py This module allows you to output calendars like the Unix cal program, and provides additional useful functions related to the calendar. By default, these calendars have...| Python documentation
Classes provide a means of bundling data and functionality together. Creating a new class creates a new type of object, allowing new instances of that type to be made. Each class instance can have ...| Python documentation
Source code: Lib/asyncio/events.py, Lib/asyncio/base_events.py Preface The event loop is the core of every asyncio application. Event loops run asynchronous tasks and callbacks, perform network IO ...| Python documentation
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
Basic indexing#| numpy.org
This PEP proposes a new special form, TypeIs, to allow annotating functions that can be used to narrow the type of a value, similar to the builtin isinstance(). Unlike the existing typing.TypeGuard special form, TypeIs can narrow the type in both the if...| Python Enhancement Proposals (PEPs)
Happy Holidays and a Happy New Year 2020 readers!| Jack Hacks
Ghostwriter| hypothesis.readthedocs.io
Source code: Lib/csv.py The so-called CSV (Comma Separated Values) format is the most common import and export format for spreadsheets and databases. CSV format was used for many years prior to att...| Python documentation
Author, A. M. Kuchling,, Release, 0.32,. In this document, we’ll take a tour of Python’s features suitable for implementing programs in a functional style. After an introduction to the concepts of ...| Python documentation
Source code: Lib/site.py This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter’s-S option. Importing this module normally appends...| Python documentation
Source code: Lib/logging/config.py Important: This page contains only reference information. For tutorials, please see Basic Tutorial, Advanced Tutorial, Logging Cookbook. This section describes th...| Python documentation
Source code: Lib/pprint.py The pprint module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the interpreter. If the formatted struc...| Python documentation
Do the best you can until you know better. Then when you know better, do better. ― Maya Angelou| Ruslan's Blog
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
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
Editor, Raymond Hettinger,. This article explains the new features in Python 3.8, compared to 3.7. Python 3.8 was released on October 14, 2019. For full details, see the changelog. Summary – Releas...| Python documentation
Source code: Lib/timeit.py This module provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a callable one. It avoids a number of common traps fo...| 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
Source code: Lib/collections/__init__.py This module implements specialized container datatypes providing alternatives to Python’s general purpose built-in containers, dict, list, set, and tuple.,,...| Python documentation
Building a fast boolean expression evaluation engine.| healeycodes.com
This chapter explains the meaning of the elements of expressions in Python. Syntax Notes: In this and the following chapters, extended BNF notation will be used to describe syntax, not lexical anal...| Python documentation
Author, Raymond Hettinger,, Contact,,. Contents: Descriptor Guide- Primer- Simple example: A descriptor that returns a constant, Dynamic lookups, Managed attributes, Customiz...| Python documentation
When I'm searching for docs, 95% of the time a single example would suffice. Yet, 95% of the time I can't find one in any official source.| rakhim.org
Learn about Python's dataclass module and implement a working version from scratch!| xavd.id
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
Generators are a tricky subject in Python. With this tutorial you’ll make the leap from class-based iterators to using generator functions and the “yield” statement in no time.| dbader.org
A tutorial on Python’s advanced data unpacking features: How to unpack data with the “=” operator and for-loops.| dbader.org
While preparing my talk for PyCascades 2023 on this very blog post series of Python's syntactic sugar, I had an inkling that I could unravel the global statement. After talking to some folks after my talk, I realized that I could, in fact, unravel it! The trick was realizing what| Tall, Snarky Canadian
This module implements a number of iterator building blocks inspired by constructs from APL, Haskell, and SML. Each has been recast in a form suitable for Python. The module standardizes a core set...| Python documentation
Floating-point numbers are represented in computer hardware as base 2 (binary) fractions. For example, the decimal fraction 0.625 has value 6/10 + 2/100 + 5/1000, and in the same way the binary fra...| Python documentation
See Python Initialization Configuration for details on how to configure the interpreter prior to initialization. Before Python Initialization: In an application embedding Python, the Py_Initialize(...| Python documentation
23 Aug 2014| limpet.net
Objects, values and types: Objects are Python’s abstraction for data. All data in a Python program is represented by objects or by relations between objects. (In a sense, and in conformance to Von ...| Python documentation
The conflict between subclassing and composition is as old as object-oriented programming. The latest crop of languages like Go or Rust prove that you don’t need subclassing to successfully write code. But what’s a pragmatic approach to subclassing in Python, specifically?| Hynek Schlawack
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
namedtuple has been around since forever, and over time, its convenience saw it used far outside its originally intended purpose. With dataclasses now covering part of those use cases, what should one use named tuples for? In this article, I address this question, and give a few examples from real code.| death and gravity
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
In this article, we look at a heuristic for using classes in Python, with examples from real-world code, and some things to keep in mind.| death and gravity
... in which we solve the day 17 problem from Advent of Code 2020, Conway Cubes, in a generic way, focusing on testing, refactoring, and idiomatic Python, in a way that helps you translate those skills to your regular, non-puzzle coding.| death and gravity
A couple weeks ago I ran [a poll on Twitter](https://twitter.com/ubernostrum/status/1096609885213491201) asking people whether they'd ever used, or considered using, the …| www.b-list.org
Crawling a website for missing resources using the Python standard library.| healeycodes.com