Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Over 30 types of variables available in python ?

Reply
Thread Tools

Re: Over 30 types of variables available in python ?

 
 
Terry Reedy
Guest
Posts: n/a
 
      01-07-2013
On 1/6/2013 6: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.


They would better be called classes. Every thing is Python is an
instance of a class. 'Iterator' and 'context manager' are protocols that
multiple classes can follow, not classes themselves.

> 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.


C has up to 8 integer types, Python 3 just 1. Most of the above are
structures in C, which may or may not by typedef-ed, or classes in C++.
If you counted all the structures and classes that come with C or C++,
you would find a comparable number.

C stdlib has a pointer to file structure type, which is equivalent to
Python's file class. It is true that C does not come with hashed arrays
(sets) and hashed associative arrays (dicts), but they are often needed.
So C programmers either reinvent the wheel or include a third-party
library. C also has frame structure, but they are normally hidden. C
programmers do not have easy direct access. However, virus writers learn
to work with them ;-(.

--
Terry Jan Reedy

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Over 30 types of variables available in python ? chaouche yacine Python 6 01-11-2013 05:20 AM
Re: Over 30 types of variables available in python ? Dave Angel Python 0 01-06-2013 11:32 PM
Over 30 types of variables available in python ? chaouche yacine Python 0 01-06-2013 11:12 PM
VOIP over VPN over TCP over WAP over 3G Theo Markettos UK VOIP 2 02-14-2008 03:27 PM
Boost + Python C/API: Mixing python return types with boost return types Steve Knight Python 2 10-10-2003 10:11 AM



Advertisments