Posts
Python: Use slice.indices results as range arguments
slice.indices(length) resolves omitted and out-of-range bounds for a sequence of known length. Use the returned triple with range() when you need the selected positions, especially …
November 25, 2026
Python: Track source reads when itertools.tee consumers diverge
itertools.tee() lets consumers advance independently over one source iterator. It reads the source only as needed and retains values for a consumer that falls behind; it does not …
November 25, 2026
Python: Return NotImplemented from unsupported ordered comparisons
functools.total_ordering fills in ordered comparisons from equality and one ordering method. Those methods should return NotImplemented for unsupported operand types so Python can …
November 25, 2026
Python: Keep bisect keys aligned with their records
Repeated searches can use a precomputed key array instead of recalculating a record’s key on each comparison. The key array and record list must use the same order and receive …
November 25, 2026
Python: Include the opening balance in itertools.accumulate
accumulate(initial=...) yields the initial value before consuming the first input. A running-balance report therefore has one more balance than transactions, including a useful …
November 25, 2026
Python: Handle a full bounded deque before inserting
A bounded deque drops an item from the opposite end when you append beyond its capacity. Inserting into a full deque instead raises IndexError. Choose which behavior your queue is …
November 25, 2026
Python: Find an executable with an explicit shutil.which search path
A script can resolve a tool from a chosen directory without changing the process environment. Pass that directory through shutil.which(path=...) and handle a missing executable …
November 25, 2026
Python: Define an empty-input result for functools.reduce
When a reduction may receive no records, supply an initializer that defines the empty result. It is also the first accumulator value, so choose it for the operation rather than …
November 25, 2026
Python: Choose deep or shallow dataclass dictionaries
dataclasses.asdict() recursively converts a record and copies its contents. If you only need a dictionary of references to the current fields, build it with fields() and getattr() …
November 25, 2026
Apache Jena Fuseki CVE-2026-86155: update the server to 6.3.0
Apache disclosed CVE-2026-86155 on November 23, 2026 UTC. Its CNA rates the issue CVSS 4.0 10.0 Critical and recommends updating Apache Jena Fuseki to 6.3.0. The affected product …
November 24, 2026