Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70293 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76395 invoked from network); 22 Nov 2013 20:21:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 20:21:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:46846] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/EE-28674-6DCBF825 for ; Fri, 22 Nov 2013 15:21:42 -0500 Received: by mail-wg0-f44.google.com with SMTP id k14so1637091wgh.35 for ; Fri, 22 Nov 2013 12:21:39 -0800 (PST) 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:to :cc:content-type; bh=UHAkUqDpCypITkp31pG9tfE7rcPYDaIWIYA/L2E8X3Q=; b=DOosYEzMI0tQ34tTR8MSUd6ey/m8GpsInQ6Tzuwda7masvMXX875bnFh3tn4S4grWN Ob9gHJ80kfykOYS+lppB5OFJcdynNj03sug8CndW3LmfboAj+oqZiW/Qjk0P/bsGqs8S YaSJDdNXLaeDAeUdhb1FR9La/97bUNC73umyqLahsMrpEaVL7J8v3hRPO/1cwWjYMiR1 Y3J3RghujEJWv0G4jtWqmO+d1iPZ+3/Wp8eX3VkzCLWFHfbzGZfEAydeVFdz1clfd+dm j6tXDRFf20VGkxx2bVD60cTgjSz9GjQkNVeoOh2zj0YxNYS1W3U89yyDQm+oX3LNSmHl MSPQ== MIME-Version: 1.0 X-Received: by 10.180.184.14 with SMTP id eq14mr4147600wic.56.1385151698970; Fri, 22 Nov 2013 12:21:38 -0800 (PST) Received: by 10.216.183.68 with HTTP; Fri, 22 Nov 2013 12:21:38 -0800 (PST) In-Reply-To: References: Date: Fri, 22 Nov 2013 20:21:38 +0000 Message-ID: To: Sherif Ramadan Cc: Tjerk Meesters , PHP Internals Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Power function as operator From: leight@gmail.com (Leigh) On 22 November 2013 17:08, Sherif Ramadan wrote: > I definitely like the idea of having pow as an operator. I've actually been > wanting to copy that from Python for a while. I'm all for it. On 22 November 2013 19:56, Sherif Ramadan wrote: > That looks very wrong. pow(pow(2,3),2) == 64 > > Exponent precedence should always be one higher than multiplication > precedence. Where Tjerk has placed it is exactly as python has it. I think right assoc is the correct choice here. If you imagine 2^3^2 written down, you would do 2^(3^2), not (2^3)^2 Python 2.7.3 (default, Jan 2 2013, 13:56:14) [GCC 4.7.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 2 ** 3 ** 2 512