Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; '32-bit': 0.09; 'assuming': 0.09; 'defines': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'spelling': 0.09; 'subject:question': 0.10; 'python': 0.11; 'jan': 0.12; 'language,': 0.12; 'components.': 0.16; 'literals': 0.16; 'literals.': 0.16; 'operators.': 0.16; 'precedence': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:library': 0.16; 'syntactic': 0.16; 'types,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'normally': 0.19; 'example': 0.22; 'manual': 0.22; 'header:User-Agent:1': 0.23; 'specifies': 0.24; 'specify': 0.24; 'define': 0.26; 'defined': 0.27; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'properties': 0.29; '(on': 0.31; 'priorities': 0.31; '"the': 0.34; 'core': 0.34; 'subject:the': 0.34; 'subject:from': 0.34; 'operations': 0.35; 'but': 0.35; 'subject:skip:d 10': 0.36; 'two': 0.37; 'implement': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'numbers': 0.61; 'received:173': 0.61; 'such': 0.63; 'places': 0.64; 'different': 0.65; 'introduction': 0.68; 'safe': 0.72; 'special': 0.74; '(always': 0.84; 'received:fios.verizon.net': 0.84; 'hand,': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: A question about semantics from the standard library's documentation Date: Thu, 19 Sep 2013 16:27:33 -0400 References: <5478c594-ef5b-4ebc-9d78-f8f12a3a6609@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Gmane-NNTP-Posting-Host: pool-173-75-251-66.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 In-Reply-To: <5478c594-ef5b-4ebc-9d78-f8f12a3a6609@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 34 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1379622474 news.xs4all.nl 15957 [2001:888:2000:d::a6]:47294 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:54447 On 9/19/2013 11:28 AM, Aseem Bansal wrote: > In Python 3.3.2 documentation on the Python Standard library's introduc= tion 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 defin= e the semantics. (On the other hand, the language core does define syntac= tic properties like the spelling and priorities of operators.)" The two preceeding sentences are "The =E2=80=9CPython library=E2=80=9D contains several different kinds of= components. It contains data types that would normally be considered part of the=20 =E2=80=9Ccore=E2=80=9D 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=20 specifies the operations in general terms of 'integers'. It specifies=20 the precedence of the operators. It does not actually specify the=20 meaning (semantics) of m + n. You are safe in assuming that (int)2 +=20 (int)2 =3D (int)4. However type(2**31) is different on 2.7- 32-bit builds= =20 (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=20 implement the operators. --=20 Terry Jan Reedy