Over 30 types of variables available in python ?

Dave Angel d at davea.name
Sun Jan 6 18:32:07 EST 2013


On 01/06/2013 06:12 PM, chaouche yacine 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.
>

First, you're describing Python 2.x ;    3.x is different in a few
ways.  For one, int and long are combined into a single type.

Variables don't have types.  Only objects have types.  A name can be
bound to any object, regardless of its type, or to what it might have
been previously bound.

Otherwise, you're right.  Python is a rich language, with "batteries
included."  There's a lot in the built-in space, but if you include the
stdlib, it's really rich.  And if you include the fact that objects you
define yourself are first-class, there are very few limits.



-- 

DaveA




More information about the Python-list mailing list