[Tutor] better map/lambda solution needed

lonetwin lonetwin <lonetwin@yahoo.com>
Fri, 26 Apr 2002 11:30:54 +0530 (IST)


Hi everybody,
     Firstly I'd like to say it's good to be back here, I was working on
 non-python stuff lately (for about 3 months) and so missed all the fun
 happening here :).
 	Anyways, here's a quick question, is there a better way to express
the following code (Note: I'm working on Python1.5). Actually, I know
there should be....but somehow, I'm not seeing the obvious.
Here goes :
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> popList = ['steve', 'foo']
>>> hostname = '@mail.foo'
>>> for nick, user in map(None, map(lambda x: x+hostname, popList), popList):
...     print nick, user
...
steve@mail.foo steve
foo@mail.foo foo
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I have a problem with all that map(None, map(lambda ...) ...) stuff.
Shows that I haven't been using python much, right ?? ;)

Peace
Steve


-- 
"Today's robots are very primitive, capable of understanding only a few
 simple instructions such as 'go left', 'go right', and 'build car'."
 --John Sladek