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!news4.google.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: Marc 'BlackJack' Rintsch <bj_...@gmx.net>
Newsgroups: comp.lang.python
Subject: Re: Newbie: Struggling again 'map'
Date: Sat, 26 May 2007 13:34:32 +0200
Organization: Freie Universitaet Berlin
Lines: 27
Message-ID: <pan.2007.05.26.11.34.32.128111@gmx.net>
References: <1180173252.906992.262570@q75g2000hsh.googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 9W1YS62bxsTGMjYPWRjDwATurlR8pTcOioTatr4ypzBoeY1WHjumEIGacy
User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux))

In <1180173252.906992.262...@q75g2000hsh.googlegroups.com>, mosscliffe
wrote:

> 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

`map()` expects a function as first argument that will be applied to the
elements in the other the arguments which have to be iterable.  That you
can give `None` as a function and the resulting behavior is IMHO a very
ugly thing and has not much to to with the semantics expected from a
`map()` function.  The `None` is not the default fill value but a
placeholder for the identity function.

Ciao,
	Marc 'BlackJack' Rintsch

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