-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Aug 30, 2006, at 5:57 PM, Guido van Rossum wrote:
> Perhaps a compromise could be to add a keyword parameter to request > such an exception? (We could even add three options: truncate, pad, > error, with truncate being the default, and pad being the old map() > and filter() behavior.) Caveat: I don't even know if /I/ like this, but I'll spit it out anyway in case it spurs an actual good idea from someone else. :) What about a keyword argument called 'filler' which can be an n-sized sequence or a callable. If it's a sequence, then when zip arguments are exhausted, you pull values for that item from the appropriate element of the sequence. If it's a callable, you call it with the items you have and None's for the exhausted ones. Whatever filler() returns, zip returns. filler() could then splice in whatever values it wants. Yeah 'None' for the missing ones can be ambiguous but oh well. You raise a ValueError if filler is a sequence of size that doesn't match the number of zip arguments or if filler() doesn't return an appropriately sized sequence. yeah-okay-dumb-5-minute-idea-ly y'rs, - -Barry P.S. OTOH, zip's current semantics never bothered me much in practice. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (Darwin) iQCVAwUBRPYPc3EjvBPtnXfVAQL5RQQAh93Sr84HaLP0Zo4hr3JBuWkhipryIx+A eCnGKXxXa8fTvBuRcaHFAryPnXxrnrhs1pmpQsf3/scJTHcwXstX8OMJvHrFRqcV KHF8qRazP271RnbDQuDBTJwcwsTFpjHtDVyNbApYxQDreiy77q4ZDyuraICKlkqo rT8hfF3Mab8= =+9HZ -----END PGP SIGNATURE----- _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
