Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Newbie: Struggling again 'map'

View parsed - Show only message text

Path: g2news1.google.com!postnews.google.com!q75g2000hsh.googlegroups.com!not-for-mail
From: mosscliffe <mcl.off...@googlemail.com>
Newsgroups: comp.lang.python
Subject: Newbie: Struggling again 'map'
Date: 26 May 2007 02:54:12 -0700
Organization: http://groups.google.com
Lines: 27
Message-ID: <1180173252.906992.262570@q75g2000hsh.googlegroups.com>
NNTP-Posting-Host: 83.100.132.186
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1180173253 32321 127.0.0.1 (26 May 2007 09:54:13 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Sat, 26 May 2007 09:54:13 +0000 (UTC)
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: q75g2000hsh.googlegroups.com; posting-host=83.100.132.186;
   posting-account=ILSRGA0AAAA__-t2Qrm6FBK6rNni9c3R

I thought I had the difference between 'zip' and 'map' sorted but when
I try to fill missing entries with something other than 'None'. I do
not seem to be able to get it to work - any pointers appreciated.

Richard

lista = ['a1', 'a2']
listb = ['b10', 'b11','b12' ,'b13']

for x,y in zip(lista, listb):    #  Fine Truncates as expected
    print "ZIP:", x, "<<x  y>>", y

for x,y in map(None, lista, listb):  #  Also fine - extends as
expected
    print "MAP:", x, "<<x  y>>", y

for x,y in map("N/A", lista, listb): ########## Fails - Can not call a
'str'
    print "MAP:", x, "<<x  y>>", y

def fillwith(fillchars):
    return fillchars

for x,y in map(fillwith("N/A"), lista, listb): ########## Fails also -
Can not call a 'str'
    print "MAP:", x, "<<x  y>>", y


Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google