Bugs item #1543347, was opened at 2006-08-20 14:59 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1543347&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Interpreter Core Group: Python 2.3 Status: Open Resolution: None Priority: 5 Submitted By: [N/A] (ymasuda) Assigned to: Nobody/Anonymous (nobody) Summary: Operator precedence inconsistent for complex literal Initial Comment: Using complex, real and imag attributes are computed collectly as follows: >>> 1+2j (1+2j) >>> z = 1+2j >>> z.real 1.0 >>> z.imag 2.0 >>> (1+2j).real 1.0 >>> (1+2j).imag 2.0 But, if there's no explicit literal boundary, it seems to break consistensy in operator precedence: >>> 1+2j.real # addition succeeds j-suffux 1.0 >>> 1+2j.imag # addition precedes (j-suffix and) attribute reference 3.0 >>> 0+1+2j.real # same as above 1.0 >>> 0+1+2j.imag 3.0 >>> 1+0+2j.imag 3.0 >>> 1+0+2j.real 1.0 >>> 1+(2j).imag # brace puts no bless 3.0 >>> 1*1+2j.imag # star fails to steer 3.0 This happens at least on Python 2.3.5 (OSX bundled), Python 2.4.2 (build from ports, FreeBSD 5.4). # Practically, of course, you always explicit (1+2j) to construct complex thus hardly troubled with this :) but it would be happy for beginners to mention it on standard tutorial or something. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1543347&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com