[IronPython] 'map' not working the same betweenIronPython-0.7.xand IronPython-0.9?

Thane thane at magna-capital.com
Wed Aug 3 23:35:41 CEST 2005


I know that this isn't a solution, but, since map() may get deprecated
sooner or later, why don't you use a list comprehension?

 

[foo(a) for a in filesraw]

 

Line above should do the trick.

 

--Thane

 

 

  _____  

From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Steven Drucker
Sent: Wednesday, August 03, 2005 1:02 PM
To: Discussion of IronPython
Subject: RE: [IronPython] 'map' not working the same
betweenIronPython-0.7.xand IronPython-0.9?

 

Typo in the sample - should read:

filesraw = System.IO.Directory.GetFiles('D:\\temp\\photos');

--S

 

 

  _____  

From: users-ironpython.com-bounces at lists.ironpython.com
[mailto:users-ironpython.com-bounces at lists.ironpython.com] On Behalf Of
Steven Drucker
Sent: Wednesday, August 03, 2005 12:55 PM
To: users-ironpython.com at lists.ironpython.com
Subject: [IronPython] 'map' not working the same between IronPython-0.7.xand
IronPython-0.9?

 

I used to be able to do the following code:

 

def foo(a):

            print a;

 

filesraw = System.IO.Directory('D:\\temp\\photos");

map(foo,filesraw);

 

and it would work just fine.

 

 

Now, however, this is no longer working. 

The error I get is as follows:

PythonTypeError: foo() takes exactly 1 argument, (97 given)

 

This seems like it should work since filesraw is enumerable and in fact, I
can do the following:

for file in filesraw:

            print file

 

 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20050803/6c2e4c3d/attachment.html>


More information about the Ironpython-users mailing list