Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4.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.019 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; "subject:' ": 0.07; 'subject:string': 0.09; 'yeah,': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'literals': 0.16; 'mandate': 0.16; 'parts,': 0.16; 'component': 0.16; 'wrote:': 0.18; 'otherwise,': 0.22; 'cc:addr:python.org': 0.22; 'parse': 0.24; 'question': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'probably': 0.32; 'there,': 0.34; 'subject:with': 0.35; 'basic': 0.35; 'received:google.com': 0.35; 'christian': 0.38; 'issue': 0.38; 'pm,': 0.38; 'rather': 0.38; 'does': 0.39; 'how': 0.40; 'expression': 0.60; 'negative': 0.60; 'times': 0.62; 'sum': 0.64; 'mar': 0.68; 'lose': 0.68; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=uEYlwmrk2occRlSWhlbQjuTcbHrI0CVpBBGIkjXRpN4=; b=JbxRT7r71l+tZeB8IWwWJE88jMj8m2G1TDAiUg5GRVe31kXGYFtm9+9nlhgx1lT5s3 uRftKIsHuorsFOV3+S4ZbN7vHwoyAjPDxY9zLtGPfiyAA+CxqDaNj3rfNf4iAy6kTsuA f31SpE818HspjZM+/05OrayX8teW7J5fqIqBPfGg7dh8dPJYbi1Z7uQbVRMggSwOnl2a 8ablqGnF9IowJ2ds7Dv9XXqaEvkJYWt/yf1rcCxPXLrx1LcIgqOPg6IxYvaHH8Rp5it9 nXW7xIoDlZOQZsgJWZoXH+vrWvTTirOS8/+SdvDuojYpTQvc3wOaOfPvbyDPtRTO8vlB hZMg== MIME-Version: 1.0 X-Received: by 10.66.11.66 with SMTP id o2mr8314191pab.142.1395126705937; Tue, 18 Mar 2014 00:11:45 -0700 (PDT) In-Reply-To: References: <8c862bec-815e-424c-81e2-8f37ebab1c35@googlegroups.com> Date: Tue, 18 Mar 2014 18:11:45 +1100 Subject: Re: 'complex' function with string argument. From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1395126715 news.xs4all.nl 2841 [2001:888:2000:d::a6]:36683 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:68488 On Tue, Mar 18, 2014 at 6:04 PM, Christian Gollwitzer wrote: > As others have explained, the basic issue is the question how to parse an > expression like > > 1+2i*3 > > is it "complex(1+2i) times 3" or is it sum of 1 and product of complex 2i > and 3? The only way to have it be the former would be to mandate that all complex literals have both parts, and you'd still lose clarity. You'd probably want to have some other symbol rather than + in there, to emphasize the connection: 1_2j 1_--2j # Negative imaginary component Otherwise, yeah, do what Python does and have imaginary literals only. ChrisA