On 9/19/2013 11:28 AM, Aseem Bansal wrote:
In Python 3.3.2 documentation on the Python Standard library's introduction 
these sentences are given

"For these types, the Python language core defines the form of literals and places 
some constraints on their semantics, but does not fully define the semantics. (On the 
other hand, the language core does define syntactic properties like the spelling and 
priorities of operators.)"

The two preceeding sentences are
"The “Python library” contains several different kinds of components.

It contains data types that would normally be considered part of the “core” of a language, such as numbers and lists."

That got me confused. What is defined by the language and what is not?
Can someone give me an example about what this means?

Take ints. The language manual specific the form of int literals. It specifies the operations in general terms of 'integers'. It specifies the precedence of the operators. It does not actually specify the meaning (semantics) of m + n. You are safe in assuming that (int)2 + (int)2 = (int)4. However type(2**31) is different on 2.7- 32-bit builds (long) and 3.0+ (always int). Also note that the language reference does not specify the int methods other than the special methods needed to implement the operators.

--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to