Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61932 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 7699 invoked from network); 1 Aug 2012 18:09:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Aug 2012 18:09:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=christoph.hochstrasser@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=christoph.hochstrasser@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: christoph.hochstrasser@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wg0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:51981] helo=mail-wg0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/4D-32875-3E079105 for ; Wed, 01 Aug 2012 14:09:39 -0400 Received: by wgx1 with SMTP id 1so5535184wgx.11 for ; Wed, 01 Aug 2012 11:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:message-id:in-reply-to:references:subject:x-mailer :mime-version:content-type:content-transfer-encoding :content-disposition; bh=WB2gdGu6Wzpfs8pX2sh1X48Qt2lKZPPTWLYqJvTaZ8I=; b=bCLs2UT406GQJMGn34ggtMW4OdfoIjWfmcf+rHzzMSniV75wHc9QD/I/v4TTRbZSg4 VSz5A6VDF2E6DAbT3HT03r1EYOMK2yQxtccM7d03066Awc/tRfb5u/Gz+MkeuUdunodq Ki7qgzV8e5QaUuzpllsRc1KukyuVofSYkEzoWA7c6CPrwiBCfMnrgfT5nnVcaHjRRP3U Beyr98MU+XXN2YMRWq6ihQUZk2ENGv3HTYLAqOiJA8GtnyKSY/deHw0xJs6vfiVftby5 WmmV5zkatUqixpZteisTGR8U8z1UTDZG/qtw8zLQ/qQ3cQ+wQ2jX7uAPPiqXMEqlCqxC KCAg== Received: by 10.216.41.195 with SMTP id h45mr9732057web.74.1343844576460; Wed, 01 Aug 2012 11:09:36 -0700 (PDT) Received: from [10.0.0.1] (80-123-38-200.adsl.highway.telekom.at. [80.123.38.200]) by mx.google.com with ESMTPS id ck9sm10433797wib.2.2012.08.01.11.09.34 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 11:09:35 -0700 (PDT) Date: Wed, 1 Aug 2012 20:09:33 +0200 To: Stas Malyshev Cc: "=?utf-8?Q?internals=40lists.php.net?=" Message-ID: In-Reply-To: <50196D53.8070703@sugarcrm.com> References: <5009E557.1090906@sugarcrm.com> <1708AB78DAB340DC8C8D7F54F652EBBF@gmail.com> <50196D53.8070703@sugarcrm.com> X-Mailer: sparrow 1.6.2 (build 1143.6) MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Subject: Re: [PHP-DEV] Implicit isset in ternary operator From: christoph.hochstrasser@gmail.com (Christoph Hochstrasser) Hi, =20 > Traceback (most recent call last): > =46ile =22=22, line 1, in > KeyError: 'a' > =20 > And it's just as annoying as in PHP. Actually, probably more annoying > :). But it has .get() which solves the problem usually, albeit in a bit= > more verbose way. Also, Python has defaultdict which I would usually us= e > when I need keys to be created automatically. Ah, ok sorry about that=E2=80=A6 This means then, that Go is less strict about this than Python. Consider this: http://play.golang.org/p/Qbc0bEBsKa -- =20 Christoph Hochstrasser http://twitter.com/hochchristoph =7C http://christophh.net =7C https://gi= thub.com/CHH Am Mittwoch, 01. August 2012 um 19:54 schrieb Stas Malyshev: > Hi=21 > =20 > > I've looked a bit into other languages (Ruby, Python, Go) and > > all of them do not generate an error when an undefined dict/hash/map = key is accessed. > =20 > =20 > =20 > Python would definitely throw an exception: > =20 > > > > a =3D =7B=7D > > > > a > > > =20 > > =20 > =20 > =20 > =7B=7D > > > > print a=5B'a'=5D > > > =20 > > =20 > =20 > =20 > =20 > -- =20 > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227