public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] portage-py3k status report
@ 2008-08-15 12:00 Ali Polatel
  2008-08-15 13:22 ` René 'Necoro' Neumann
  0 siblings, 1 reply; 4+ messages in thread
From: Ali Polatel @ 2008-08-15 12:00 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 293 bytes --]

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

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-portage-dev] portage-py3k status report
  2008-08-15 12:00 [gentoo-portage-dev] portage-py3k status report Ali Polatel
@ 2008-08-15 13:22 ` René 'Necoro' Neumann
  2008-08-15 14:26   ` [gentoo-portage-dev] " Ali Polatel
  2008-08-15 18:12   ` [gentoo-portage-dev] " Zac Medico
  0 siblings, 2 replies; 4+ messages in thread
From: René 'Necoro' Neumann @ 2008-08-15 13:22 UTC (permalink / raw
  To: gentoo-portage-dev

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




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [gentoo-portage-dev] Re: portage-py3k status report
  2008-08-15 13:22 ` René 'Necoro' Neumann
@ 2008-08-15 14:26   ` Ali Polatel
  2008-08-15 18:12   ` [gentoo-portage-dev] " Zac Medico
  1 sibling, 0 replies; 4+ messages in thread
From: Ali Polatel @ 2008-08-15 14:26 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

René 'Necoro' Neumann yazmış:
> What's the best way to send patches for the patches ;) ?

In this particular case you shouldn't send patches for patches, so it's
not a problem, see below ;)

<snip>
> 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).
> 

Portage aims for 2.4 compatibility and your snippets should work on 2.4
afaik. So you can submit it as a patch to the current trunk.
Changing the automatically generated output is not a good idea.

> Regards,
> Necoro

-- 
Regards,
Ali Polatel

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-portage-dev] portage-py3k status report
  2008-08-15 13:22 ` René 'Necoro' Neumann
  2008-08-15 14:26   ` [gentoo-portage-dev] " Ali Polatel
@ 2008-08-15 18:12   ` Zac Medico
  1 sibling, 0 replies; 4+ messages in thread
From: Zac Medico @ 2008-08-15 18:12 UTC (permalink / raw
  To: gentoo-portage-dev

-----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-----



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-08-15 18:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-15 12:00 [gentoo-portage-dev] portage-py3k status report Ali Polatel
2008-08-15 13:22 ` René 'Necoro' Neumann
2008-08-15 14:26   ` [gentoo-portage-dev] " Ali Polatel
2008-08-15 18:12   ` [gentoo-portage-dev] " Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox