[Tutor] How python keeps track of data types

Ben Finney ben+python at benfinney.id.au
Mon Mar 28 18:14:35 EDT 2016


Abhishek Kumar <abhishekkmr18 at gmail.com> writes:

> I am a computer science student,I want to know how python keeps track
> of data types of variables

Python doesn't track the type of a variable, because a variable never
has any information about type.

What Python calls “variables” are names, referring to objects. Names
have no type. Every object has a type, so Python doesn't “track” the
type in the sense you mean.

-- 
 \          “Any sufficiently advanced bug is indistinguishable from a |
  `\                                          feature.” —Rich Kulawiec |
_o__)                                                                  |
Ben Finney



More information about the Tutor mailing list