TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #124 · 27 јул.

Словарь это очень распространённый тип данных в Python. Он присутствует буквально в каждом скрипте. Именованные аргументы (kwargs), атрибуты объекта (ˍˍdictˍˍ), любые неймспейсы и тд. Одна из основных особенностей словаря была в том, что это неупорядоченное множество. То есть порядок добавления ключей не гарантирует что они сохранятся в той же последовательности. Но всё изменилось в Python3.6. Как это произошло? Словарь, как часто используемый тип данных, стараются максимально оптимизировать. Про одну из таких оптимизация нам рассказывает PEP468 - Preserving the order of **kwargs in a function. Хм, причем здесь оптимизация? Всё начинается с отдельной имплементации Python под названием PyPy. В этой версии интерпретатора сделали довольно хорошую оптимизацию словарю. Показательно разница описана на этой странице Если вкратце, то дело вот в чём. Словарь на стороне С это массив. Каждый элемент это тоже массив из 3х элементов (хеш ключа, ключ и значение). Раньше, чтобы всякий раз при обновлении словаря не изменять размер массива в С (это затратно по времени), изначально он делался с запасом. Как только массив заполняется, его еще увеличивают с запасом, обычно на 1/3. При этом элементы, еще не занятые данными, заполнялись пустышками (полный пример на странице по ссылке выше) entries = [ ['--', '--', '--'], [-8522787127447073495, 'barry', 'green'], ['--', '--', '--'], ['--', '--', '--'], ['--', '--', '--'], [-9092791511155847987, 'timmy', 'red'], ['--', '--', '--'], [-6480567542315338377, 'guido', 'blue'] ] Перерасход памяти очевиден. И что было предложено? Переделать структуру данных словаря разделив его на данные и индексы. indices = [None, 1, None, None, None, 0, None, 2] entries = [[-9092791511155847987, 'timmy', 'red'], [-8522787127447073495, 'barry', 'green'], [-6480567542315338377, 'guido', 'blue']] Именно этот принцип повторили в Python 3.6. Что мы получаем в итоге? 🔸 Увеличилась скорость поиска и добавления ключей. 🔸 Сократился расход памяти в 3 раза Python 2.x-3.5 >>> d = {x: x*2 for x in range(100)} >>> d.ˍˍsizeofˍˍ() 12536 Python 3.6 >>> d = {x: x*2 for x in range(100)} >>> d.ˍˍsizeofˍˍ() 4680 Ведь теперь вместо элемента ['--', '--', '--'] у нас просто None, который, кстати, является одним и тем же объектом где бы он не использовался. 🔸 Как бонус (или как побочный эффект), мы получаем упорядоченность ключей. То есть одним выстрелом завалили трёх мамонтов! #pep

Hashtags

Резултати

Пронајдени 1,002 слични објави

Пребарај: #python

当前筛选 #python清除筛选
Linuxgram 🐧

@linuxgram · Post #18747 · 11.05.2026 г., 14:45

📰 Feature freeze for Python 3.15 as first beta released JIT compiler much improved, but no reinstatement for leaky incremental garbage collector. 🔗 Source: https://www.theregister.com/devops/2026/05/11/feature-freeze-for-python-315-as-first-beta-released/5237934 #python

Hashtags

Linuxgram 🐧

@linuxgram · Post #18631 · 30.04.2026 г., 15:35

📰 New Python Backdoor Uses Tunneling Service to Steal Browser and Cloud Credentials Cybersecurity researchers have disclosed details of a stealthy Python-based backdoor framework called DEEP#DOOR that comes with capabilities to establish persistent access and harvest a wide range of sensitive information from compromised hosts."The intrusion chain begins with execution of a batch script ('install_obf.bat') that disables Windows security controls, dynamically extracts an. 🔗 Source: https://thehackernews.com/2026/04/new-python-backdoor-uses-tunneling.html #python

Hashtags

Linuxgram 🐧

@linuxgram · Post #18589 · 27.04.2026 г., 17:17

📰 PyPI package with 1.1M monthly downloads hacked to push infostealer An attacker pushed a malicious version of the popular elementary-data package Python Package Index (PyPI) to steal sensitive developer data and cryptocurrency wallets. 🔗 Source: https://www.bleepingcomputer.com/news/security/pypi-package-with-11m-monthly-downloads-hacked-to-push-infostealer/ #python

Hashtags

GitHub Trends

@githubtrending · Post #15623 · 16.04.2026 г., 12:00

#python DFlash is a lightweight block diffusion model that speeds up large language models like Qwen3.5 and Llama through speculative decoding, generating draft tokens in parallel for over 6x faster inference with no quality loss—up to 2.5x better than top methods. It supports easy integration with vLLM, SGLang, Transformers, or MLX via simple installs and commands, with ready models on Hugging Face. You benefit by running quicker AI generation on your hardware, boosting throughput to ~430 tokens/second and GPU use over 90% for efficient tasks like math or coding. https://github.com/z-lab/dflash

Hashtags

GitHub Trends

@githubtrending · Post #15606 · 06.04.2026 г., 12:30

#python PersonaPlex is a real-time speech model for natural, low-latency conversations. Control its voice with audio prompts and role via simple text—like a friendly teacher, customer service rep, or casual chat partner—with natural male/female voices. Install easily, launch a web demo server, and test offline. You benefit by creating personalized AI interactions for apps, role-play, or fun talks, with quick setup and low GPU needs via CPU offload. https://github.com/NVIDIA/personaplex

Hashtags

GitHub Trends

@githubtrending · Post #15590 · 27.03.2026 г., 11:30

#python AI Scientist-v2 is an autonomous AI system that generates research ideas, runs experiments, analyzes data, and writes full scientific papers using agentic tree search—no human templates needed. It produced the first entirely AI-written paper accepted via peer review at an ICLR workshop. You benefit by quickly exploring ML topics, automating discovery to save time and costs (about $20 per run on Linux with GPU), and scaling your research productivity for faster breakthroughs. Install via conda, set API keys, ideate with a Markdown file, then launch experiments. Run in a safe sandbox due to code risks. https://github.com/SakanaAI/AI-Scientist-v2

Hashtags

GitHub Trends

@githubtrending · Post #15560 · 14.03.2026 г., 12:00

#python Dimensional OS (DimOS) is a simple Python-based operating system for robots like quadrupeds, humanoids, drones, and arms from Unitree, Xarm, and more—no ROS needed. Install easily with one command, run simulations or real hardware, and use natural language like "explore the room" for agent control with navigation, perception, spatial memory, and multi-agent systems. You benefit by quickly building and testing advanced robot apps locally, saving time and enabling seamless hardware integration without complex setups. https://github.com/dimensionalOS/dimos

Hashtags

GitHub Trends

@githubtrending · Post #15555 · 12.03.2026 г., 12:00

#python OpenRAG is an intelligent document search platform that combines three powerful open-source tools—Docling, OpenSearch, and Langflow—to transform your documents into an AI-powered knowledge system. You upload files of any format (PDFs, Word documents, images, audio), and the system intelligently parses and indexes them for semantic search. Then you chat with your documents through a simple interface, getting accurate answers backed by relevant sources. The benefit is that you get enterprise-grade document retrieval and AI conversations ready to use immediately, without building complex systems from scratch, while maintaining full control over how documents are processed and searched. https://github.com/langflow-ai/openrag

Hashtags

GitHub Trends

@githubtrending · Post #15544 · 06.03.2026 г., 12:30

#python Webnovel Writer is a free Claude Code plugin for creating long web novels. It reduces AI forgetting and errors with smart RAG tools, letting you init projects (/webnovel-init), plan plots (/webnovel-plan), write chapters (/webnovel-write), review (1-5), and view dashboards. Install via marketplace, add Python deps, set API keys, and use commands easily. Benefits: Saves time on consistent long stories, boosts creativity for serials, and tracks progress without manual fixes—perfect for steady novel output. https://github.com/lingfengQAQ/webnovel-writer

Hashtags

GitHub Trends

@githubtrending · Post #15540 · 05.03.2026 г., 12:00

#python SEO Machine is a Claude Code tool for businesses to easily create long SEO blog posts. Use commands like /research for keyword and competitor analysis, /write for 2000+ word optimized articles in your brand voice, /rewrite to update old content, and /optimize for final SEO scores (0-100). It integrates Google Analytics, Search Console, and DataForSEO for real data, plus agents for meta tags, links, and readability. Customize with your brand files for perfect fit. You save hours on research/writing, get higher Google rankings, more traffic, and content that converts readers to customers. https://github.com/TheCraigHewitt/seomachine

Hashtags

GitHub Trends

@githubtrending · Post #15529 · 28.02.2026 г., 12:30

#python Hermes Agent is a free, open-source AI that installs on your server, learns your projects and preferences over time, and handles tasks via Telegram, Discord, Slack, WhatsApp, or terminal. It builds reusable skills from solved problems, runs scheduled automations like daily reports, and uses secure sandboxes (Docker/SSH) for safe code execution with any AI model. You benefit by getting a smart, growing assistant that automates work, remembers everything, and stays reachable anywhere—saving hours on repetitive tasks while boosting productivity. https://github.com/NousResearch/hermes-agent

Hashtags

GitHub Trends

@githubtrending · Post #15519 · 24.02.2026 г., 12:00

#python PersonaLive creates real-time portrait animations from a single image, using driving videos for expressive faces and head moves. It runs on a 12GB GPU for infinite-length videos, with easy web UI for live streaming or offline generation, plus ComfyUI and TensorRT speed boosts. You get smooth, high-quality animations fast for streams, content, or art—up to 22x quicker than others, saving time and hardware costs. https://github.com/GVCLab/PersonaLive

Hashtags

123•••5•••10•••15•••20•••25•••30•••35•••40•••45•••50•••55•••60•••65•••70•••75•••80•••8384
ПретходнаСтраница 1 од 84Следна