Over 30 types of variables available in python ?

Chris Angelico rosuav at gmail.com
Mon Jan 7 00:22:39 CET 2013

On Mon, Jan 7, 2013 at 10:12 AM, chaouche yacine
<yacinechaouche at yahoo.com> wrote:
> booleans
> ints, floats, longs, complexes
> strings, unicode strings
> lists, tuples, dictionaries, dictionary views, sets, frozensets, buffers,
> bytearrays, slices
> functions, methods, code objects,modules,classes, instances, types, nulls
> (there is exactly one object of type Null which is None), tracebacks, frames
> generators, iterators, xranges,
> files,
> memoryviews,
> context managers,
> These are all listed in this page
> http://docs.python.org/2/library/stdtypes.html as built-in types. Am I
> getting anything wrong here ? I'm a bit confused about it. I have never seen
> so many types in the few programming languages I saw.

Not quite. Python has one type of variable: the name binding. Those
are different types of objects.

Since you can subclass object to make your own class, there's an
infinite number of types available. But the ones you'll be using in
most programs are:
* boolean, int, float (and long, in Python 2, but in Python 3 that's
the same as int)
* Unicode strings
* In Python 2, bytes strings
* lists, tuples, dicts, maybe sets
* functions
* files

The rest, you're unlikely to worry much about. The program will use
them under the covers, but you don't need to concern yourself with the
details. The only other thing you'll need to look at is the generic
handling of object() and, by virtue of subclassing, every other


More information about the Python-list mailing list