From VM Tue Dec 26 18:03:42 2000 Return-Path: Received: from ns2.digicool.com ([216.164.72.2] verified) by digicool.com (CommuniGate Pro SMTP 3.3.1) with ESMTP id 399952 for xxxxx@mail.digicool.com; Tue, 26 Dec 2000 16:49:08 -0500 Received: from mail.python.org (starship.python.net [63.102.49.30]) by ns2.digicool.com (8.9.3/8.9.3) with ESMTP id QAA00928 for ; Tue, 26 Dec 2000 16:49:01 -0500 Received: from ns1.zope.org (localhost.localdomain [127.0.0.1]) by mail.python.org (Postfix) with ESMTP id 0CE1CE9B2 for ; Tue, 26 Dec 2000 16:48:01 -0500 (EST) Delivered-To: mm+python-list-admin@python.org Received: from cata.hud.ac.uk (cata.hud.ac.uk [161.112.232.16]) by mail.python.org (Postfix) with ESMTP id 5398EE9B2 for ; Tue, 26 Dec 2000 16:47:33 -0500 (EST) Received: from hud.ac.uk by cata.hud.ac.uk id <13167-0@cata.hud.ac.uk>; Tue, 26 Dec 2000 21:47:28 +0000 Message-Type: Delivery Report X400-Received: by /PRMD=UK.AC/ADMD= /C=GB/; Relayed; Tue, 26 Dec 2000 21:47:27 +0000 X400-Received: by mta cata.hud.ac.uk in /PRMD=UK.AC/ADMD= /C=GB/; Relayed; Tue, 26 Dec 2000 21:47:27 +0000 X400-MTS-Identifier: [/PRMD=UK.AC/ADMD= /C=GB/;cata.hud.a:131600:20001226214727] Message-ID: <"cata.hud.a:131600:20001226214727"@hud.ac.uk> Content-Identifier: RE: A Q conce... MIME-Version: 1.0 Content-Type: multipart/report; boundary="---Multi-Part-Report-Level-1-1-13166" Errors-To: python-list-owner@python.org Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: From: postmaster@hud.ac.uk Sender: python-list-owner@python.org To: python-list-admin@python.org Subject: Delivery Report (failure) for zzzzz@example.uk Date: Tue, 26 Dec 2000 21:47:28 +0000 X-BeenThere: python-list@python.org X-Mailman-Version: 2.0 -----Multi-Part-Report-Level-1-1-13166 This report relates to your message: Subject: RE: A Q concerning map (a comparison to Maple V), Message-ID: , To: of Tue, 26 Dec 2000 21:47:27 +0000 Your message was not delivered to: zzzzz@example.uk for the following reason: Diagnostic was Unable to transfer, Message timed out Information Message timed out The Original Message follows: -----Multi-Part-Report-Level-1-1-13166 Content-Type: message/delivery-status Reporting-MTA: x400; mta cata.hud.ac.uk in /PRMD=UK.AC/ADMD= /C=GB/ Arrival-Date: Sat, 23 Dec 2000 21:44:56 +0000 DSN-Gateway: dns; cata.hud.ac.uk X400-Conversion-Date: Tue, 26 Dec 2000 21:47:28 +0000 Original-Envelope-Id: [/PRMD=UK.AC/ADMD= /C=GB/;, To: Original-Recipient: rfc822; zzzzz@example.uk Final-Recipient: x400; /S=zzzzz/OU=example/PRMD=UK.AC/ADMD= /C=GB/ X400-Originally-Specified-Recipient-Number: 1 Action: failed Diagnostic-Code: Reason 1 (Unable-To-Transfer); Diagnostic 5 (Maximum-Time-Expired) Status: 4.4.7 X400-Supplementary-Info: "Message timed out" X400-Last-Trace: Sat, 23 Dec 2000 21:44:56 +0000 -----Multi-Part-Report-Level-1-1-13166 Content-Type: message/rfc822 Received: from mail.python.org (actually host starship.python.net) by cata.hud.ac.uk with SMTP (Mailer); Sat, 23 Dec 2000 21:44:56 +0000 Received: from ns1.zope.org (localhost.localdomain [127.0.0.1]) by mail.python.org (Postfix) with ESMTP id 9200FEB18; Sat, 23 Dec 2000 13:10:09 -0500 (EST) Delivered-To: mm+python-list@python.org Received: from mail.rdc1.md.home.com (ha1.rdc1.md.home.com [24.2.2.66]) by mail.python.org (Postfix) with ESMTP id 9FA2AEC45 for ; Sat, 23 Dec 2000 12:35:46 -0500 (EST) Received: from cj569191b ([65.1.136.53]) by mail.rdc1.md.home.com (InterMail vM.4.01.03.00 201-229-121) with SMTP id <20001223173546.KSYS10139.mail.rdc1.md.home.com@cj569191b> for ; Sat, 23 Dec 2000 09:35:46 -0800 From: Tim Peters To: python-list Subject: RE: A Q concerning map (a comparison to Maple V) Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 In-Reply-To: <3A448735.4DF3C95C@schneider-kamp.de> Importance: Normal Sender: python-list-admin@python.org Errors-To: python-list-admin@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.0 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: Date: Sat, 23 Dec 2000 12:35:50 -0500 [Franz GEIGER] > > map(replace, ["abc", "cde"], "c", "C"); > > instead of having to create a lambda function. > > Wouldn't it make sense to have that in Python too? Do there come > > more such opportunities into your mind? [Peter Schneider-Kamp] > If I get you right you intend this to mean: > > map(replace, ["abc", "cde"], ["c"]*2, ["C"]*2) > > So basically your proposal is to reuse map parameters > which are no sequences in every iteration over the > parameters who are, It's hard to tell for sure, but that was my guess too. In array languages, this kind of thing is ubiquitous and is often called "scalar broadcast" (where a scalar is any atomic value (as opposed to an array), and is "broadcast" to every position of the arrays in which it's combined via some operation). There was a long debate about this a few years ago on c.l.py, where I championed scalar broadcast in map specifically. It collapsed under its own hideous weight when-- as such things always do --that originally modest goal got hijacked by people seeking to extend the semantics to every corner of the language. That won't happen. > ... > But how would you decide if "abc" is a sequence parameter > or not? That is a problem! Kinda. Mostly people want to broadcast numbers (as in Franz's original example), and there's no problem there. A cheap workaround for sequences that are desired to be treated as scalars would have been to introduce a new builtin scalar() function, that simply hid the "sequenceness" of its argument from map. Note that the listcomps in 2.0 make scalar broadcast much easier to spell; e.g. [replace(x, "c", "C") for x in ("abc", "cde")] [x**2 + 5 for x in L] So the better solution is not to extend map, but to forget it <0.9 wink>. a-life-strategy-of-universal-applicability-ly y'rs - tim -- http://www.python.org/mailman/listinfo/python-list -----Multi-Part-Report-Level-1-1-13166--