What's the best way to send patches for the patches ;) ?
For example in
http://dev.gentoo.org/~hawking/portage-2to3/auto/11-portage-2to3-map.patch
- there is the following hunk:
diff --git a/pym/portage/process.py b/pym/portage/process.py
index f766d30..dc425af 100644
--- a/pym/portage/process.py
+++ b/pym/portage/process.py
@@ -21,7 +21,7 @@ except ImportError:
if os.path.isdir("/proc/%i/fd" % os.getpid()):
def get_open_fds():
- return map(int, [fd for fd in os.listdir("/proc/%i/fd" %
os.getpid()) if
fd.isdigit()])
+ return list(map(int, [fd for fd in os.listdir("/proc/%i/fd" %
os.getpid()) if fd.isdigit()]))
else:
def get_open_fds():
return xrange(max_fd_limit)
But the complete expression could be rewritten as:
return [int(fd) for fd in os.listdir("/proc/%i/fd" % os.getpid()) if
fd.isdigit()]
This is more readable - and you don't need to traverse the list multiple
times.
Alternatively - if you like the functional style more:
return list(map(int, filter(str.isdigit, os.listdir("/proc/%i/fd" %
os.getpid()
Again more readable (if you are used to the functional style ;)) - and only
one traversal (as iterators are used).
/edit: I sent this mail twice, because Roundcube had chosen the wrong
sender name and I guess, that this mail was blocked then. Excuses if you
get the mail twice.
Regards,
Necoro