Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:61930 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4704 invoked from network); 1 Aug 2012 17:54:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 1 Aug 2012 17:54:32 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.123 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.123 smtp123.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.123] ([67.192.241.123:40337] helo=smtp123.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F3/AC-32875-75D69105 for ; Wed, 01 Aug 2012 13:54:31 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id EEA8778438; Wed, 1 Aug 2012 13:54:28 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp2.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 7F6C5784B4; Wed, 1 Aug 2012 13:54:28 -0400 (EDT) Message-ID: <50196D53.8070703@sugarcrm.com> Date: Wed, 01 Aug 2012 10:54:27 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Christoph Hochstrasser CC: Matthew Weier O'Phinney , "internals@lists.php.net" References: <5009E557.1090906@sugarcrm.com> <1708AB78DAB340DC8C8D7F54F652EBBF@gmail.com> In-Reply-To: <1708AB78DAB340DC8C8D7F54F652EBBF@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implicit isset in ternary operator From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > 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. Python would definitely throw an exception: >>> a = {} >>> a {} >>> print a['a'] Traceback (most recent call last): File "", line 1, in KeyError: 'a' 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 use when I need keys to be created automatically. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227