Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion Newbie: Struggling again 'map'
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Marc 'BlackJack' Rintsch  
View profile  
 More options May 26 2007, 9:34 pm
Newsgroups: comp.lang.python
From: Marc 'BlackJack' Rintsch <bj_...@gmx.net>
Date: Sat, 26 May 2007 13:34:32 +0200
Local: Sat, May 26 2007 9:34 pm
Subject: Re: Newbie: Struggling again 'map'
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.

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