From: "René 'Necoro' Neumann" <lists@necoro.eu>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] portage-py3k status report
Date: Fri, 15 Aug 2008 15:22:10 +0200 [thread overview]
Message-ID: <a6fa10803c5300856590c8b9657469de@mail.necoro.eu> (raw)
In-Reply-To: <20080815120017.GA23506@trippin>
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:
<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)
</hunk>
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
next prev parent reply other threads:[~2008-08-15 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-15 12:00 [gentoo-portage-dev] portage-py3k status report Ali Polatel
2008-08-15 13:22 ` René 'Necoro' Neumann [this message]
2008-08-15 14:26 ` [gentoo-portage-dev] " Ali Polatel
2008-08-15 18:12 ` [gentoo-portage-dev] " Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a6fa10803c5300856590c8b9657469de@mail.necoro.eu \
--to=lists@necoro.eu \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox