syntax difference

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Jun 17 04:43:42 EDT 2018


On Sat, 16 Jun 2018 23:11:41 -0700, Jim Lee wrote:

>    Python is not like other languages.

Python is not like languages like C, Pascal, Algol, Fortran, D, Java 
(unboxed native values only) and those like that.

However, Python *is* like other languages like Javascript, Ruby, Java 
(objects only), PHP, and others.

> For one thing, there are no
> "variables" in Python (in the way you think of them).

Indeed -- there are no variables in Python, if you think of a variable as 
meaning a virtual box at a fixed memory address, containing a value, and 
associated with a type, like in C or Pascal.


> There are only
> objects and names.  Names can be thought of like void pointers in C, for
> example.  They don't have a "type" themselves - they only refer to
> objects, and the type of object they refer to can change at will.

Very true.


> Also, there are no integers in Python.  Scalar values are actually
> objects. The number 35 is not an integer, it is an object that has an
> integer type.

I would put it another way. Python certainly has integers, but there are 
no integers in C, there are only fixed-width collections of one or more 
bytes. They don't have any integer methods, or methods at all.


-- 
Steven D'Aprano
"Ever since I learned about confirmation bias, I've been seeing
it everywhere." -- Jon Ronson




More information about the Python-list mailing list