On Tue, 25 Jan 2005 11:46:04 -0800, Jeff Shannon <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote: > >> On 25 Jan 2005 08:30:03 GMT, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: >> >>>If you are after readability, you might prefer this... >>> >>>def hamming(): >>> def _hamming(): >>> yield 1 >>> for n in imerge(imap(lambda h: 2*h, iter(hamming2)), >>> imerge(imap(lambda h: 3*h, iter(hamming3)), >>> imap(lambda h: 5*h, iter(hamming5)))): >>> yield n >>> hamming2, hamming3, hamming5, result = tee(_hamming(), 4) >>> return result >> >> Are the long words really that helpful? >> >> def hamming(): >> def _hamming(): >> yield 1 >> for n in imerge(imap(lambda h: 2*h, iter(hg2)), >> imerge(imap(lambda h: 3*h, iter(hg3)), >> imap(lambda h: 5*h, iter(hg5)))): >> yield n >> hg2, hg3, hg5, result = tee(_hamming(), 4) # four hamming generators >> return result > >Well, judging by the fact that shortening the identifiers made it so >that you felt the need to add a comment indicating what they were >identifying, I'd say that yes, the long words *are* helpful. ;) >Comments are good, but self-documenting code is even better. The comment was a conscious factoring decision, in terms of documentation ;-) Regards, Bengt Richter -- http://mail.python.org/mailman/listinfo/python-list