SShortSingh.
Back to feed

Developer builds frozndict, a fast immutable hashable dictionary for Python and Node.js

0
·4 views

A developer has released frozndict, an immutable, insertion-ordered, hashable dictionary implemented in safe Rust with bindings for Python and Node.js. The library addresses a long-standing gap in Python's standard library, where dicts cannot be used as cache keys or function arguments requiring hashability. frozndict computes its hash once at construction time for O(1) lookups and offers O(1) copy operations by returning a shared Arc pointer rather than duplicating data. Benchmarks on Python 3.12.3 show frozndict outperforming existing alternatives like frozendict and immutables.Map in iteration speed and copy performance. Mutation attempts are blocked at the Rust level, raising a TypeError, making the structure reliably immutable by design.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How Python's Fernet Library Uses Symmetric Encryption to Protect Stored Credentials

Desktop applications that store passwords or API keys locally face a security risk when saving credentials as plain text, since those files can be exposed through backups, sync folders, or accidental sharing. Symmetric encryption addresses this by using a single key to both encrypt and decrypt data within the same application, making it well-suited for local credential storage. Python's cryptography library offers Fernet, a ready-to-use recipe that combines AES encryption, HMAC-based integrity verification, and URL-safe Base64 encoding into one secure package. Unlike plain encryption, Fernet's built-in HMAC check ensures that any tampering with the stored token causes decryption to fail entirely, protecting data integrity alongside confidentiality. The primary challenge with this approach lies in key management, as losing the encryption key renders stored data permanently unreadable, making secure and redundant key storage a critical part of any implementation.

0
ProgrammingDEV Community ·

How Math Concepts Improve Code: A C Developer's Rock-Paper-Scissors Comparison

A developer revisited two versions of a Rock-Paper-Scissors game written in C to demonstrate how mathematical thinking leads to cleaner, more efficient code. The first version contained a subtle but significant bug — reading an uninitialized variable in a while-loop condition — which happened to work only due to favorable garbage memory values, not correct logic. The second, improved version applied modular arithmetic to handle game logic more precisely and concisely, replacing brittle workarounds with mathematically grounded solutions. The author argues that math provides programmers with reliable building blocks for problem-solving, rather than relying on trial and error. The full source code for both implementations has been made publicly available on GitHub for comparison.

0
ProgrammingDEV Community ·

How to Properly Verify Self-Hosted LLM Tool Specs Before Integration

Many self-hosted LLM tools on GitHub carry inaccurate or misleading documentation, mixing marketing claims with incomplete technical details on RAM, GPU, licensing, and offline capability. Developers often discover these discrepancies only after spending hours integrating a tool, when it crashes or underperforms on their hardware. To verify true hardware requirements, experts recommend cross-referencing GitHub Issues for real user reports, checking CI/CD configuration files, and hunting for community benchmarks rather than relying on README figures. License accuracy should be confirmed by reading the actual LICENSE file in the repo root, which is legally binding and may contradict the project's marketing page. Offline capability claims also require scrutiny, as some tools still require internet access for authentication, telemetry, or initial model downloads despite being labeled offline-capable.

0
ProgrammingDEV Community ·

VIGÍA ML Brings In-Browser AI Monitoring to Gas Wells Without Cloud Dependency

VIGÍA ML is an open-source predictive monitoring console for gas wells that runs entirely in the browser using TensorFlow.js and React, with no backend or cloud infrastructure required. The tool trains four machine learning models — an LSTM production forecaster, an autoencoder anomaly detector, a neural fault classifier, and a recommendation layer — directly on user-loaded well data within each session. It was built to address a key challenge in the oil and gas industry: proprietary well data such as tubing pressure and flow rates cannot easily be sent to cloud pipelines due to security, cost, and connectivity constraints. Designed as a Progressive Web App, VIGÍA ML works fully offline, making it suitable for remote field sites with unreliable internet access. The Spanish-first interface targets Latin American operations teams, and the project is available under a source-available license on GitHub.