[Python-Dev] Python Enhancement Proposals (PEPs)
M.-A. Lemburg
mal@lemburg.com
Thu, 13 Jul 2000 20:44:27 +0200
Fredrik Lundh wrote:
>
> ?!ng wrote:
> > > Re: open issues: marry([0, 1, 2]) should return [(1,), (2,), (3,)]
> > > Otherwise user-code will probably have to special case more often.
>
> as in
>
> # normal case
> for (x,) in zip([0, 1, 2]):
> ...
>
> vs.
>
> # special case
> for x in zip([0, 1, 2]):
> ...
>
> ?
Uhm, why should marry() be defined for a single argument ?
IMHO, this only masks program errors.
BTW:
>>> from mx.Tools import NewBuiltins
>>> marry = tuples
>>> john = lists
>>> marry([0,1,2])
Traceback (innermost last):
File "<stdin>", line 1, in ?
TypeError: sequence elements must be sequences
>>> marry([0,1,2],[3,4,5])
[(0, 3), (1, 4), (2, 5)]
>>> john([0,1,2],[3,4,5])
([0, 3], [1, 4], [2, 5])
... the code is there. I'd say: use it :-)
(Who invented those silly function names ?)
--
Marc-Andre Lemburg
______________________________________________________________________
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/