Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'syntax': 0.04; 'subject:Python': 0.06; 'float': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'ah,': 0.16; 'message-id:@4ax.com': 0.16; 'omitting': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:user': 0.16; 'syntaxerror:': 0.16; '>>>': 0.22; 'url:home': 0.24; 'looks': 0.24; 'equivalent': 0.26; 'skip:" 20': 0.27; 'header:X-Complaints- To:1': 0.27; 'chris': 0.29; 'evaluation': 0.30; '"",': 0.31; 'file': 0.32; 'but': 0.35; 'charset:us-ascii': 0.36; 'subject:New': 0.37; 'received:76': 0.38; 'nov': 0.38; 'needed': 0.38; 'to:addr:python-list': 0.38; 'skip:- 10': 0.38; 'skip:. 10': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'space': 0.40; 'subject: / ': 0.60; 'invalid': 0.68; '2013': 0.98 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: New user's initial thoughts / criticisms of Python Date: Sun, 10 Nov 2013 12:12:56 -0500 Organization: IISS Elusive Unicorn References: <-JadnUirYuhUruPPnZ2dnUVZ8rSdnZ2d@bt.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-76-249-28-120.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 6.00/32.1186 X-No-Archive: YES 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: 30 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1384103588 news.xs4all.nl 15947 [2001:888:2000:d::a6]:41165 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:59017 On Sun, 10 Nov 2013 20:22:56 +1100, Chris Angelico declaimed the following: >[1] You can write "(1234).to_bytes(2,'big')" but omitting the parens >gives a SyntaxError because it looks like the start of a float >literal. Ah, but... >>> -123.bit_length() Traceback ( File "", line 1 -123.bit_length() ^ SyntaxError: invalid syntax >>> (-123).bit_length() 7 >>> -123 .bit_length() -7 No parens needed if a space precedes the . But note the order of evaluation is equivalent to >>> -(123 .bit_length()) -7 >>> -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/