Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Sichere ProgrammierungBreeze TTS 2 vs ElevenLabs: Open Source TTS Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungAgentic AI vs Generative AI: The 2026 Verdict(23.09.2026 um 05:44 Uhr)
Sichere ProgrammierungI made my agent prove every quote against the source document(23.09.2026 um 05:45 Uhr)
Sichere Programmierung8mb.video Alternative: Skip the Line, Skip the Upsell(23.09.2026 um 05:47 Uhr)
Sichere ProgrammierungBuilding a GTA 6 JSON API for entities and current status(23.09.2026 um 05:52 Uhr)
Sichere ProgrammierungEvery filter needs a documented exception(23.09.2026 um 06:01 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

What Really Happens When You Write x = 10

We assume you already know how to write simple Python programs and understand basic syntax (if, for, functions, lists). Here, we're not discussing how to use the language, but why it works the way it does. If you ask a beginner what this…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

We assume you already know how to write simple Python programs and understand basic syntax (if, for, functions, lists). Here, we're not discussing how to use the language, but why it works the way it does.




If you ask a beginner what this line of code does:




x = 10






the answer is usually something like:




"The number 10 is stored in the variable x."




At first glance, that sounds perfectly reasonable. We're used to thinking of a variable as a box or a memory cell that can hold a value. First the box is empty, then we put a number, a string, or a list into it.



The problem is that Python doesn't actually work that way.



To understand many of Python's behaviors, it's helpful to stop thinking of variables as containers for data. Instead, think of a variable as a name that refers to an object.



When Python executes:




x = 10






it doesn't start with the variable - it starts with the object 10.



The number 10 is an object. Once that object exists, the name x is bound to it.



Visually, you can think of it like this:




x ───► 10






The arrow indicates that the name x refers to the object whose value is 10.



At first, this distinction may seem unimportant. What difference does it make whether the number is stored inside the variable or the variable simply points to it?



As it turns out, the difference is enormous, and it explains many of Python's most important behaviors.



Now suppose we add another line:




y = x






Many people expect Python to create a second copy of the number and store it in another variable.



That's not what happens.



Instead, the name y is simply bound to the very same object that x already refers to.



Now the picture looks like this:




x ─┐
├──► 10
y ─┘






There's still only one object, but now there are two names that refer to it.



That's why Python makes a clear distinction between objects and names.



Objects hold data.



Names allow you to access those objects.



Things become even more interesting when a variable appears to "change."



Consider this code:




x = 10
x = 20






If you think of variables as boxes, it's natural to imagine that the number 10 inside the box has somehow been replaced with 20.



But that's not what Python does.



Initially, the name x refers to the object 10:




x ───► 10






After the second assignment, the name refers to a different object:




x ───► 20






The object 10 hasn't changed, disappeared, or turned into 20.



The name x has simply been rebound to another object.



This may seem like a subtle detail, but it's one of the fundamental ideas behind Python's execution model.



Later, we'll see that it explains many things that often confuse beginners:




  • why modifying a list can unexpectedly affect another variable;

  • why is and == are not the same;

  • why strings behave differently from lists;

  • and how Python passes arguments to functions.



For now, remember just one idea.



When you write:




x = 10






Python doesn't put the number into a variable.



It binds the name x to the object 10.



That's why experienced Python developers usually don't say that a variable stores a value. Instead, they say that a name refers to an object.



It may sound a little less intuitive at first, but it's much closer to how Python actually works.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten What Really Happens When You Write x = 10

Thematisch verwandte Begriffe: What, Really, Happens, When · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-18163 | IBM Financial Transaction Manager (FTM) for RedHat OpenShift could allow…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick