Robin Kohrs
Robin Kohrs

Reputation: 697

Python Names and Variables

I know this was addressed probably a thousand times already and might be a really dumb question. But what happens exactly if you create a python variabel(name)? For example if you type : x = 2 I know Python creates an intobject which holdsthe interger 2. But the x actually is a pointer to that object ? And in case it is, where is this pointer itself stored and does it consume memory? Sorry again for this horribly typed question (sucks doing it on the phone) and the question itself. Any help is highly appreciated

Upvotes: 0

Views: 49

Answers (1)

chepner
chepner

Reputation: 531708

x is a name. The value associated with that name is an int object representing 2. Anything else is an implementation detail, not specified by the language itself.

Upvotes: 2

Related Questions