Re: [gentoo-portage-dev] portage-py3k status report

2008-08-15 Thread Zac Medico
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

René 'Necoro' Neumann wrote:
> But the complete expression could be rewritten as:
> 
> return [int(fd) for fd in os.listdir("/proc/%i/fd" % os.getpid()) if
> fd.isdigit()]
> 

Applied, thanks.

- --
Thanks,
Zac
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.9 (GNU/Linux)

iEYEARECAAYFAkilxyUACgkQ/ejvha5XGaPxXgCgkGAmT1Gf2lF840SXov8RbL31
7ucAnRyJnA3/HSKbV538YBQ0cRxqTSdG
=pcZr
-END PGP SIGNATURE-



Re: [gentoo-portage-dev] portage-py3k status report

2008-08-15 Thread René 'Necoro' Neumann
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




[gentoo-portage-dev] portage-py3k status report

2008-08-15 Thread Ali Polatel
Hi,
I've written a status report¹ about portage py3k conversion. It tells
about the current state, what needs to be done etc.
I'll be updating the page so people can learn about the current status.

¹: http://dev.gentoo.org/~hawking/portage-2to3/status.xml

-- 
Regards,
Ali Polatel


pgpBFbU1QeIVp.pgp
Description: PGP signature