[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread R. David Murray
R. David Murray added the comment: Heh. There was a discussion in issue 22106 about valid examples for using 'pass'. This case is analogous to the one I came up with. for x in map(...): pass that avoids building a list. Not that any of it is idiomatic, as you say. -- nosy

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: The whole example is bad and should be removed or replace with something else: 1. Using map() is an anti-pattern here, since the function results are not used. 2. To build a dictionary that maps the ordinals from 0 to 255 to their character equivalents

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Raymond Hettinger
Raymond Hettinger added the comment: The whole example is bad and should be removed or replace with something else: I'm not sure there are ANY examples of operator.setitem that couldn't be done a better way without it. How about we remove it and leave the examples for things that people

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Antoine Pitrou
Antoine Pitrou added the comment: Le 10/08/2014 13:20, Raymond Hettinger a écrit : Raymond Hettinger added the comment: The whole example is bad and should be removed or replace with something else: I'm not sure there are ANY examples of operator.setitem that couldn't be done a better

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9c250f34bfa3 by Raymond Hettinger in branch '3.4': Issue #22180: Remove weak example http://hg.python.org/cpython/rev/9c250f34bfa3 -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org

[issue22180] operator.setitem example no longer works in Python 3 due to lazy map

2014-08-10 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22180 ___

Fwd: How to draw a map using python

2014-08-09 Thread Yuanchao Xu
To kind whom it may concern: I want to draw a map using python, not really a map with full information, just a get together of a series of small shapes to reflect land use. The data is like below 1 2 2 3 3 22 3 3 1 1 21 1 1 1 3 33 3 3 3 4 1 Each number represents one land use type

[issue12506] NIS module cant handle multiple NIS map entries for the same GID

2014-06-24 Thread Mark Lawrence
Mark Lawrence added the comment: @bjorn terribly sorry for the delay here :-( Would you be able to supply a patch for this, including doc and unittest changes as appropriate? -- nosy: +BreamoreBoy versions: +Python 3.5 -Python 2.6, Python 3.1, Python 3.2, Python 3.3

[issue21237] Update Python 2/3 porting HOWTO's suggestion for dealing with map()

2014-05-09 Thread Brett Cannon
Brett Cannon added the comment: I never bothered to mention the iter* methods in the HOWTO, and since it becomes very obvious very fast to tweak them I'm not going to worry about it and add more complexity to the doc. -- resolution: - wont fix status: open - closed

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-28 Thread Duncan Booth
Chris Angelico ros...@gmail.com wrote: # Snapshot of keys: for k in list(d): if f(k): del d[k] No extra loop at the end, no switching out and in of contents, just one little change in the loop header. Obviously you don't want to do this when you're deleting two out of three billion,

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Charles Hixson
On 04/25/2014 10:53 AM, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be expected

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Tim Chase
On 2014-04-26 12:25, Charles Hixson wrote: I expect that I'll be deleting around 1/3 during each iteration of the process...and then adding new ones back in. There shouldn't be a really huge number of deletions on any particular pass, but it will be looped through many times... If you have

Re: Proper deletion of selected items during map iteration in for loop

2014-04-26 Thread Peter Otten
Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be expected

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Steven D'Aprano
On Sat, 26 Apr 2014 12:25:27 -0700, Charles Hixson wrote: On 04/25/2014 10:53 AM, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Chris Angelico
On Sun, Apr 27, 2014 at 12:14 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I think the two obviously good enough approaches are: - save a to be deleted list, then delete those keys; - copy the not to be deleted items into a new dict For a small enough dict that the

Re: Proper deletion of selected items during map iteration in for loop: Thanks to all

2014-04-26 Thread Roy Smith
In article 535c67e9$0$29965$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I think the two obviously good enough approaches are: - save a to be deleted list, then delete those keys; - copy the not to be deleted items into a new dict There

Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Charles Hixson
What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should be expected): RuntimeError: dictionary changed size

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Chris Angelico
On Sat, Apr 26, 2014 at 3:53 AM, Charles Hixson charleshi...@earthlink.net wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Matthew Barnett
On 2014-04-25 18:53, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere del m[k] But this gives (as should

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Terry Reedy
On 4/25/2014 2:04 PM, Matthew Barnett wrote: On 2014-04-25 18:53, Charles Hixson wrote: What is the proper way to delete selected items during iteration of a map? What I want to do is: for (k, v) in m.items(): if f(k): # do some processing of v and save result elsewhere

Re: Proper deletion of selected items during map iteration in for loop

2014-04-25 Thread Tim Chase
On 2014-04-25 14:50, Terry Reedy wrote: If you expect to delete more than half the keys *and* if there are no other references to the dict, such that you need the particular object mutated, this might be better. If that's your precondition, then it might be better to do something like keep

[issue21237] Update Python 2/3 porting HOWTO's suggestion for dealing with map()

2014-04-16 Thread Josh Rosenberg
Josh Rosenberg added the comment: I think the suggestion is intended for how do I keep Python 2 semantics in Python 3?, not how can I write my Python 2 code so it will run equivalently in Python 3? It wouldn't be a bad idea to point out that you can adopt Py3 semantics initially so as to

[issue21237] Update Python 2/3 porting HOWTO's suggestion for dealing with map()

2014-04-15 Thread Brett Cannon
New submission from Brett Cannon: In Python 2.6 and newer you can import future_builtins and use everything from there. In Python 2.5 it should be itertools.imap(). This is much cleaner than the current suggestion at https://docs.python.org/2/howto/pyporting.html#update-map-for-imbalanced

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-03-09 Thread Jessica McKellar
Jessica McKellar added the comment: Thanks for the patch, Gareth.Rees! The patch applies cleanly and the docs build cleanly with it. I visually inspected the addition in the built HTML docs and it looks good. = patch review -- keywords: +needs review -patch nosy: +jesstess stage:

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-03-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 16c5d7c289c6 by Benjamin Peterson in branch '2.7': note that future_builtin's map is not quite like python 3's (closes #19363) http://hg.python.org/cpython/rev/16c5d7c289c6 -- nosy: +python-dev resolution: - fixed stage: patch review

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-02-17 Thread Gareth Rees
only: Note: In Python 3, map() does not accept None for the function argument. -- keywords: +patch Added file: http://bugs.python.org/file34117/issue19363.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-02-15 Thread A.M. Kuchling
A.M. Kuchling added the comment: Gareth Rees: it doesn't look like you attached the patch mentioned in your 02/04 comment. -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-02-08 Thread Nick Coghlan
Nick Coghlan added the comment: Switched to be a docs-only bug as Gareth suggested. -- assignee: rhettinger - docs@python components: +Documentation -Library (Lib) nosy: +docs@python, ncoghlan resolution: wont fix - stage: committed/rejected - needs patch

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-02-04 Thread Gareth Rees
to the documentation for future_builtins.map: Note: In Python 3, map() does not accept None for the function argument. (zip() can be used instead.) -- status: closed - open ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2014-01-31 Thread Eric V. Smith
Eric V. Smith added the comment: I agree with Raymond: it would have been nice to do this, but it's too late. Closing. -- nosy: +eric.smith resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-12-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: I agree with you in principle, but it is far too late in 2.7's development to take away a capability. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363

simple ElementTree based parser that allows entity definition map

2013-12-04 Thread Robin Becker
% of the strings I need to parse. I think I can live with the non-reparsing of the map output, but can I get Python 3 to do the UseForeignDTD thing? -- Robin Becker -- https://mail.python.org/mailman/listinfo/python-list

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-10-24 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- assignee: - rhettinger nosy: +rhettinger ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363 ___

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-10-23 Thread Gareth Rees
New submission from Gareth Rees: In Python 2.7, future_builtins.map accepts None as its first (function) argument: Python 2.7.5 (default, Aug 1 2013, 01:01:17) from future_builtins import map list(map(None, range(3), 'ABC')) [(0, 'A'), (1, 'B'), (2, 'C')] But in Python 3.x

[issue19363] Python 2.7's future_builtins.map is not compatible with Python 3's map

2013-10-23 Thread Jon Clements
Changes by Jon Clements jon...@googlemail.com: -- nosy: +joncle ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19363 ___ ___ Python-bugs-list

[issue18782] sqlite3 row factory and multiprocessing map

2013-08-20 Thread Ned Deily
Ned Deily added the comment: I agree with Richard's comments. The crash appears to be a result of an unsupported usage of SQLite and one that Python can't really protect you from. -- resolution: - invalid stage: - committed/rejected status: open - closed

[issue18782] sqlite3 row factory and multiprocessing map

2013-08-19 Thread Timothy O'Keefe
New submission from Timothy O'Keefe: If you run this code, you will get a segfault. If you a) remove the row factory from the following code or b) use the standard library map() instead of multiprocessing.Pool.map, then the code does not crash. #!/usr/bin/env python import sqlite3 import

[issue18782] sqlite3 row factory and multiprocessing map

2013-08-19 Thread Ned Deily
Ned Deily added the comment: What platform are you running on? Please run the following script in the same environment as you get the segfault and report the results. #!/usr/bin/env python import multiprocessing import platform import sqlite3 import sys print(sys.version)

[issue18782] sqlite3 row factory and multiprocessing map

2013-08-19 Thread Timothy O'Keefe
(INSERT INTO stocks VALUES ('1992-01-06','SELL','AAPL',20,512.99)) c.execute(SELECT * FROM stocks) ## --- map fun over cursor (fun does little to nothing) pool = mp.Pool(processes=mp.cpu_count()) rows = pool.map(fun, c) def fun(row): _ = len(row) return row if __name__

[issue18782] sqlite3 row factory and multiprocessing map

2013-08-19 Thread Richard Oudkerk
Richard Oudkerk added the comment: Adding the line features[0][0] to the end of main() produces a segfault for me on Linux. The FAQ for sqlite3 says that Under Unix, you should not carry an open SQLite database across a fork() system call into the child process. Problems will

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
this does *not* work with Python 2.7 as you suggested it would. op = map(A.fun,l) Traceback (most recent call last): File stdin, line 1, in module TypeError: unbound method fun() must be called with A instance as first argument (got int instance instead) This, however, does: op = map(A(3).fun,l

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Hi Joshua thanks! I think you might not understand what Chris said. Currently this does *not* work with Python 2.7 as you suggested it would. op = map(A.fun,l) Yeah actually that wouldn't work even in Python 3, since value attribute used by fun has not been set. It was my mistake

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 09:33, Luca Cerone luca.cer...@gmail.com wrote: To correct my example: from multiprocessing import Pool class A(object): def __init__(self,x): self.value = x def fun(self,x): return self.value**x l = range(100) p = Pool(4) op = p.map(A(3).fun,

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
doesn't work neither in Python 2.7, nor 3.2 (by the way I can't use Python 3 for my application). Are you using Windows? Over here on 3.3 on Linux it does. Not on 2.7 though. No I am using Ubuntu (12.04, 64 bit).. maybe things changed from 3.2 to 3.3? from multiprocessing import Pool

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 11:10, Luca Cerone luca.cer...@gmail.com wrote: I can't try it now, I'll let you know later if it works! (Though just by reading I can't really understand what the code does). Well, from multiprocessing import Pool from functools import partial class A(object): def

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Peter Otten
Joshua Landau wrote: On 7 August 2013 11:10, Luca Cerone luca.cer...@gmail.com wrote: I can't try it now, I'll let you know later if it works! (Though just by reading I can't really understand what the code does). Well, from multiprocessing import Pool from functools import partial

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 15:46, Peter Otten __pete...@web.de wrote: import copy_reg import multiprocessing import new new is deprecated from 2.6+; use types.MethodType instead of new.instancemethod. def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Peter Otten
Joshua Landau wrote: On 7 August 2013 15:46, Peter Otten __pete...@web.de wrote: def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just getattr -- you can replace the two uses of make_instancemethod with getattr and delete this ;). D'oh ;) --

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Thanks for the post. I actually don't know exactly what can and can't be pickles.. not what partialing a function means.. Maybe can you link me to some resources? I still can't understand all the details in your code :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Joshua Landau
On 7 August 2013 23:26, Luca Cerone luca.cer...@gmail.com wrote: Thanks for the post. I actually don't know exactly what can and can't be pickles.. I just try it and see what works ;). The general idea is that if it is module-level it can be pickled and if it is defined inside of something

Re: Using Pool map with a method of a class and a list

2013-08-07 Thread Luca Cerone
Thanks for the help Peter! def make_instancemethod(inst, methodname): return getattr(inst, methodname) This is just getattr -- you can replace the two uses of make_instancemethod with getattr and delete this ;). D'oh ;) --

Using Pool map with a method of a class and a list

2013-08-06 Thread Luca Cerone
) p = Pool(4) op = p.map(A.fun,l) #using this with the normal map doesn't cause any problem This fails because it says that the methods can't be pickled. (I assume it has something to do with the note in the documentation: functionality within this package requires that the __main__ module

Re: Using Pool map with a method of a class and a list

2013-08-06 Thread Chris Angelico
On Tue, Aug 6, 2013 at 6:12 PM, Luca Cerone luca.cer...@gmail.com wrote: from multiprocessing import Pool class A(object): def __init__(self,x): self.value = x def fun(self,x): return self.value**x l = range(10) p = Pool(4) op = p.map(A.fun,l) Do you ever

Re: Using Pool map with a method of a class and a list

2013-08-06 Thread Luca Cerone
): self.value = x def fun(self,x): return self.value**x l = range(10) p = Pool(4) op = p.map(A.fun,l) #using this with the normal map doesn't cause any problem This fails because it says that the methods can't be pickled. (I assume

Re: Using Pool map with a method of a class and a list

2013-08-06 Thread Luca Cerone
Hi Chris, thanks Do you ever instantiate any A() objects? You're attempting to call an unbound method without passing it a 'self'. I have tried a lot of variations, instantiating the object, creating lambda functions that use the unbound version of fun (A.fun.__func__) etc etc.. I have

Re: 2-D drawing/map with python

2013-03-14 Thread Matteo Boscolo
Il 12/03/2013 16:58, Huseyin Emre Guner ha scritto: Hello, I am newbie in Python. I would like to make a project using python. The main ideo of this project is that a user enters the x,y values to the Gui(PyQt or Gtk) and then a 2-D map is plotted due to the x,y values. First, I use Pygame

2-D drawing/map with python

2013-03-12 Thread Huseyin Emre Guner
Hello, I am newbie in Python. I would like to make a project using python. The main ideo of this project is that a user enters the x,y values to the Gui(PyQt or Gtk) and then a 2-D map is plotted due to the x,y values. First, I use Pygame commands (pygame.draw.line(window, (255, 255, 255), (10

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread py.user
New submission from py.user: http://docs.python.org/3/library/mmap.html examples use map as a name for the mmap object -- assignee: docs@python components: Documentation messages: 184015 nosy: docs@python, py.user priority: normal severity: normal status: open title: In mmap doc

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- keywords: +easy nosy: +ezio.melotti stage: - needs patch type: performance - enhancement versions: +Python 2.7, Python 3.2, Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread Aman Shah
Aman Shah added the comment: Corrected map - mymap. -- keywords: +patch nosy: +Aman.Shah Added file: http://bugs.python.org/file29386/issue17402.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17402

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread py.user
py.user added the comment: how about mm ? -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17402 ___ ___ Python-bugs-list mailing list

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread py.user
Changes by py.user bugzilla-mail-...@yandex.ru: Added file: http://bugs.python.org/file29390/mm.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17402 ___

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread Roundup Robot
Roundup Robot added the comment: New changeset c226133b1493 by Ezio Melotti in branch '2.7': #17402: avoid shadowing built-in map in mmap examples. Initial patch by Aman Shah. http://hg.python.org/cpython/rev/c226133b1493 New changeset df27ea4bdebd by Ezio Melotti in branch '3.2': #17402

[issue17402] In mmap doc examples map() is shadowed

2013-03-12 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the report and the patches! (py.user, if you specify your real name, next time I can give you credits too.) -- assignee: docs@python - ezio.melotti resolution: - fixed stage: needs patch - committed/rejected status: open - closed

Issue with seeded map generation

2012-12-08 Thread Graham Fielding
Hey, all! I've managed to get my project to a semi-playable state (everything functions, if not precisely the way I'd like it to). One small issue is that when the player movs from one level to the next, the items and monsters in the previous level all 'reset' and return to the positions

Re: Issue with seeded map generation

2012-12-08 Thread Mitya Sirenef
the player can drop an item and come back to it later. Should I add something to the 'drop_item' function, or call soemthing in make_map? How many levels do you have and how much does each take up in memory? It might be ok to to simply save the level in memory under its number; if the map

Re: Issue with seeded map generation

2012-12-08 Thread Hans Mulder
On 8/12/12 22:32:22, Graham Fielding wrote: Hey, all! I've managed to get my project to a semi-playable state (everything functions, if not precisely the way I'd like it to). One small issue is that when the player moves from one level to the next, the items and monsters in the previous

Re: Issue with seeded map generation

2012-12-08 Thread Ian Kelly
the item/monster locations so the player can drop an item and come back to it later. Make the level generation process two-step. Step 1, build the map. Step 2, populate it with items and monsters. When the level is left, save the state and positions of the items and monsters in it along

[issue16573] 2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange

2012-11-29 Thread Roundup Robot
Roundup Robot added the comment: New changeset 3c6d8461b09f by Benjamin Peterson in branch '3.2': enumerate only requires an iterable (closes #16573) http://hg.python.org/cpython/rev/3c6d8461b09f New changeset 4ff17cf130eb by Benjamin Peterson in branch '3.3': merge 3.2 (#16573)

[issue16573] 2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange

2012-11-29 Thread Benjamin Peterson
Benjamin Peterson added the comment: Thanks for the patch. -- nosy: +benjamin.peterson ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16573 ___ ___

[issue16573] 2to3 should treat enumerate like sorted for zip, map, filter, dict, xrange

2012-11-28 Thread Jonathan Kotta
sorted for zip, map, filter, dict, xrange type: behavior Added file: http://bugs.python.org/file28152/enumerate.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16573

Re: fmap(), inverse of Python map() function

2012-10-06 Thread vasudevram
On Saturday, October 6, 2012 5:01:40 AM UTC+5:30, Devin Jeanpierre wrote: On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly wrote: I realize that. My point is that the function *feels* more like a variant of reduce than of map. If it's meant as a complaint, it's a poor one. It's

Re: fmap(), inverse of Python map() function

2012-10-06 Thread vasudevram
Thanks to all who replied. Always good to learn something new. P.S. A reader posted a good comment with Scala as well as Python code for a compose function (basically same functionality as fmap, or more - the compose once, run many times thing). It's the 4th comment on my blog post. -

fmap(), inverse of Python map() function

2012-10-05 Thread vasudevram
http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html - Vasudev Ram www.dancingbison.com jugad2.blogspot.com twitter.com/vasudevram -- http://mail.python.org/mailman/listinfo/python-list

Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote: http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html Your fmap is a special case of reduce. def fmap(functions, argument): return reduce(lambda result, func: func(result), functions, argument

Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 3:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote: http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html Your fmap is a special case of reduce. def fmap(functions, argument

Re: fmap(), inverse of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote: http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map-function.html Your fmap is a special case of reduce. So is map. def map(f, seq

Re: fmap(), inverse of Python map() function

2012-10-05 Thread Ian Kelly
On Fri, Oct 5, 2012 at 4:52 PM, Devin Jeanpierre jeanpierr...@gmail.com wrote: On Fri, Oct 5, 2012 at 5:31 PM, Ian Kelly ian.g.ke...@gmail.com wrote: On Fri, Oct 5, 2012 at 2:19 PM, vasudevram vasudev...@gmail.com wrote: http://jugad2.blogspot.in/2012/10/fmap-inverse-of-python-map

Re: fmap(), inverse of Python map() function

2012-10-05 Thread Devin Jeanpierre
On Fri, Oct 5, 2012 at 7:24 PM, Ian Kelly ian.g.ke...@gmail.com wrote: I realize that. My point is that the function *feels* more like a variant of reduce than of map. If it's meant as a complaint, it's a poor one. It's not. Fair enough all around. Sorry for misunderstanding. -- Devin

[issue16073] fix map() statement in list comprehension example

2012-09-28 Thread Peter Inglesby
Peter Inglesby added the comment: Have attached a patch with suggested update. Have also grepped for similar issues elsewhere in documentation, and haven't found anything, but may have missed something. -- keywords: +patch nosy: +inglesp Added file:

[issue16073] fix map() statement in list comprehension example

2012-09-28 Thread Chris Jerdonek
Chris Jerdonek added the comment: 2.7 is not affected. -- assignee: docs@python - chris.jerdonek versions: +Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16073 ___

[issue16073] fix map() statement in list comprehension example

2012-09-28 Thread Roundup Robot
Roundup Robot added the comment: New changeset 6c96878eb729 by Chris Jerdonek in branch '3.2': Close issue #16073: fix map() example in list comprehension documentation. http://hg.python.org/cpython/rev/6c96878eb729 New changeset 8a4a88b1e964 by Chris Jerdonek in branch 'default': Close issue

[issue16073] fix map() statement in list comprehension example

2012-09-28 Thread Chris Jerdonek
Chris Jerdonek added the comment: Thanks for helping with the patch and search, Peter. -- resolution: - fixed stage: needs patch - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16073

[issue16073] fix map() statement in list comprehension example

2012-09-27 Thread Chris Jerdonek
New submission from Chris Jerdonek: Date: Thu, 20 Sep 2012 15:14:36 -0400 To: d...@python.org Subject: [docs] map objects are not lists 5.1.3. List Comprehensionshttp://docs.python.org/dev/tutorial/datastructures.html#list-comprehensions List comprehensions provide a concise way

[issue15702] Multiprocessing Pool deadlocks on join after empty map operation

2012-08-17 Thread Richard Oudkerk
Changes by Richard Oudkerk shibt...@gmail.com: -- resolution: - duplicate stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15702 ___

[issue15702] Multiprocessing Pool deadlocks on join after empty map operation

2012-08-16 Thread James Hutchison
New submission from James Hutchison: Following code deadlocks on Windows 7 64-bit, Python 3.2.3 If you have a pool issue a map operation over an empty iterable then try to join later, it will deadlock. If there is no map operation or blah in the code below isn't empty, it does not deadlock

[issue15702] Multiprocessing Pool deadlocks on join after empty map operation

2012-08-16 Thread Antoine Pitrou
Changes by Antoine Pitrou pit...@free.fr: -- nosy: +sbt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15702 ___ ___ Python-bugs-list mailing list

[issue15702] Multiprocessing Pool deadlocks on join after empty map operation

2012-08-16 Thread Jeff Knupp
Jeff Knupp added the comment: This is a duplicate of http://bugs.python.org/issue12157, which was fixed. -- nosy: +Jeff.Knupp ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15702 ___

Re: Faster way to map numpy arrays

2012-06-26 Thread Oscar Benjamin
On 25 June 2012 08:24, Stefan Behnel stefan...@behnel.de wrote: Saurabh Kabra, 25.06.2012 05:37: I have written a script to map a 2D numpy array(A) onto another array(B) of different dimension. more than one element (of array A) are summed and mapped to each element of array B

Re: Faster way to map numpy arrays

2012-06-25 Thread Stefan Behnel
Saurabh Kabra, 25.06.2012 05:37: I have written a script to map a 2D numpy array(A) onto another array(B) of different dimension. more than one element (of array A) are summed and mapped to each element of array B. To achieve this I create a list where I store the index of array

Re: Faster way to map numpy arrays

2012-06-25 Thread Oscar Benjamin
On 25 June 2012 08:24, Stefan Behnel stefan...@behnel.de wrote: Saurabh Kabra, 25.06.2012 05:37: I have written a script to map a 2D numpy array(A) onto another array(B) of different dimension. more than one element (of array A) are summed and mapped to each element of array B

Re: Faster way to map numpy arrays

2012-06-25 Thread Saurabh Kabra
). But I solved that problem by simply adding zero elements to make a regular 3D numpy array out of the list. Saurabh On 25 June 2012 08:24, Stefan Behnel stefan...@behnel.de wrote: Saurabh Kabra, 25.06.2012 05:37: I have written a script to map a 2D numpy array(A) onto another array(B

Faster way to map numpy arrays

2012-06-24 Thread Saurabh Kabra
I have written a script to map a 2D numpy array(A) onto another array(B) of different dimension. more than one element (of array A) are summed and mapped to each element of array B. To achieve this I create a list where I store the index of array A to be mapped to array B. The list

[issue12897] Support for iterators in multiprocessing map

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: Unless you have a reason why imap() does not solve the problem I will eventually close the issue as rejected. -- resolution: - rejected stage: - committed/rejected status: open - pending ___

[issue12897] Support for iterators in multiprocessing map

2012-06-11 Thread andrew cooke
andrew cooke and...@acooke.org added the comment: hi - i'm the original author (may be using a different account). as far as i remember, i raised this because it seemed relevant given the link i gave. if you've looked at the issue and think your approach would work, or that this should be

[issue12897] Support for iterators in multiprocessing map

2012-06-11 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: I'll close then. -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12897 ___

[issue12897] Support for iterators in multiprocessing map

2012-06-08 Thread Richard Oudkerk
Richard Oudkerk shibt...@gmail.com added the comment: If you want lazy operation then you should use imap(f, it[, chunksize]) rather than using map_async(f, it). This will return an iterator rather than a list. Also, the iterator's next() method has a timeout argument. (chunksize is the

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Vladimir Berkutov
New submission from Vladimir Berkutov dair.t...@gmail.com: It might be useful to introduce a new map() and filter() methods to iterators and iterables. Both methods should accept lambda/function which transforms a single argument into value. Both methods should return another iterator

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Ramchandra Apte
Ramchandra Apte maniandra...@gmail.com added the comment: Sorry, small mistake. Actually all the other Python 2.x releases are in security-fix mode. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue14961

[issue14961] map() and filter() methods for iterators

2012-05-30 Thread Ramchandra Apte
Ramchandra Apte maniandra...@gmail.com added the comment: I think this is quite a major change to Python and this needs a PEP BTW issue912738 and therefore this bug no longer applies to Python 3. In Python 3 map returns an iterator. Even if you wanted to implement this feature in Python 2

<    1   2   3   4   5   6   7   8   9   10   >