今日已更新 311 条资讯 | 累计 29453 条内容
关于我们

今日精选

HOT

最新资讯

共 29453 篇
第 830/1473 页
AI 资讯 Dev.to

An Open Letter to init - I'm Leaving You for @dataclass

A quick disclaimer: This article isn't an argument against init itself. Constructors remain the appropriate place for lightweight object initialization. For classes that require complex setup, resource allocation, or business logic, many developers prefer to keep init minimal and move that complexity into factory methods, builders, or dedicated initialization routines. The point here is simply that when a class exists only to represent data, @dataclass eliminates a significant amount of unnecessary boilerplate. If you’ve been writing Python for any length of time, you’ve probably created dozens of classes that look something like this: There is nothing inherently wrong with this code. In fact, it is exactly how many of us first learned to write Python classes. The problem is that most of the implementation has nothing to do with the problem we’re trying to solve. Instead, it consists of repetitive plumbing — constructors, string representations, and equality methods that are nearly identical from one class to the next. The @dataclass decorator Python’s dataclasses module, introduced in Python 3.7, eliminates nearly all of this repetitive boilerplate. Instead of manually implementing methods such as init , repr , and eq , you simply declare the object's fields as type-annotated class attributes. The @dataclass decorator automatically generates the supporting methods, allowing you to focus on the data the class represents rather than the mechanics of managing it. These three lines produce exactly the behavior written by hand above, and more. Instances are created the way you would expect, print readably, and compare by value rather than by identity. Why This Matters in AI You might be wondering why I’m so excited about saving twenty lines of code. The answer is simple: AI applications are built from data contracts. Every stage of an AI pipeline passes structured information from one component to another. Requests become prompts. Prompts become model outputs. Outputs b

Stackmetric 2026-06-25 23:35 4 原文
AI 资讯 Dev.to

What actually changed in two weeks

I built a large feature. That's not what this is about. What changed is the baseline — the standards, docs, and automation that exist now and didn't two weeks ago. Everything after this will be built on top of it. Automated tests now ship with new features QA testers were testing. The product was covered. What didn't exist was automation — no E2E suite, no unit tests for new work, no repeatable spec. Now it does. The manual QA cycle stays. The automation catches what humans miss on the tenth pass. Quality leap going forward. Human hours saved. The next feature ships with both. The baseline is set Knowledge lives in the repo. Bug catalog with root causes — so the same thing doesn't get fixed twice. Tech debt inventory with a phased plan. Testing strategy documented, not assumed. GraphQL schema committed and validated against — drift gets caught before it ships. Pre-commit hooks that enforce the standards automatically. The frontend and backend documentation are cross-referenced as single sources of truth. The agent instructions point to the right places. Everything new builds on what's already written. Schema-first development The workflow is now: if the schema accommodates the new field, reuse what exists. If it doesn't, the schema update creates the new structure, the data migrates, and everything stays consistent. No guessing. No drift. One source of truth for what the data looks like. The feature is what you see. The baseline is what you don't — and it matters more.

Vilius 2026-06-25 23:35 6 原文
AI 资讯 Dev.to

Super Intelligence – first phase: simulation (SkyNet)

In the last essay I played a game with twelve people. Twelve apostles, one teacher, one set of events — and twelve sharply distinct ways of failing and succeeding to understand the same thing. Peter acts before he reflects, Thomas demands the marks in the hands, Matthew counts and structures, Judas asks what you'll give him. I called it pre-cognitive-science cognitive science: the Gospels did the hard work of selecting twelve incompatible human responses to one encounter, and every century since has projected its newest psychology onto that fixed set and found it fits. That essay had a quiet move in it I want to pull on now. The thing that doesn't change, I wrote, is the twelve people. The cognitive vocabularies come and go; the diversity of minds is the invariant. So here is the obvious next question, the one I couldn't stop turning over after I published: what happens when you stop counting people and start counting cultures? Not twelve apostles meeting one teacher, but N civilizations meeting one world. The same exercise, zoomed out A culture is not just a cuisine and a flag. It is a way of thinking that a few million people inherited without choosing it — an implicit operating system for what counts as obvious, what counts as rude, what counts as a good life, what counts as a threat. And like the apostles, each one is an answer to a question . You can describe any of them, I think, with three coordinates. A driver — the deep need the culture is organized around. Survival, honor, harmony, freedom, salvation, mastery, belonging. The thing that, if you threaten it, the culture treats as an attack on existence itself. A provoking question — the founding question the culture exists as a standing answer to. How do we survive the winter together? How do we live rightly before the gods? How do we stay free? How do we keep the harmony so the group doesn't tear itself apart? Cultures are old answers to questions most of their members have forgotten were ever asked. A thin

Aleksey Razbakov 2026-06-25 23:33 9 原文
AI 资讯 The Verge AI

How the World Cup became a US streaming success story

This is Lowpass by Janko Roettgers, a newsletter on the ever-evolving intersection of tech and entertainment, syndicated just for The Verge subscribers once a week. The 2026 World Cup is breaking streaming records around the world: Brazil's CazéTV YouTube livestream of that country's opening game against Morocco surpassed 12 million concurrent viewers, a new milestone […]

Janko Roettgers 2026-06-25 23:30 12 原文
AI 资讯 Reddit r/programming

Building an Entity Component System: Data Oriented Hierarchies

Data Oriented Design is the practice of building code that's optimized for the hardware it runs on. Entity Component Systems help writing DOD-friendly code by laying out otherwise allocation-heavy game data in contiguous arrays. A challenge in gamedev however is that lots of game data is stored and accessed as hierarchies that change frequently, which makes them notoriously difficult to store as contiguous arrays. This article goes over a number of techniques an Entity Component System can use to integrate hierarchies with the core datamodel in a way that improves the performance of the ECS. Written mostly for gamedev, but also applies to other hierarchy-heavy applications, like UI. submitted by /u/ajmmertens [link] [留言]

/u/ajmmertens 2026-06-25 23:15 5 原文