[Python-Dev] re: list comprehension / pop quiz

Fredrik Lundh fredrik@pythonware.com
Thu, 13 Jul 2000 15:54:27 +0200


(hmm.  doesn't python-dev look a whole lot like python-list these
days?  maybe this thread, and its cousins, could be moved over to
comp.lang.python for a while?)

greg wrote:
> 2. Need separate functions for creating tuples, lists, dicts, etc.  I
>    liked Ken M.'s idea of one function that took a type argument, and
>    stitched/married/wove/welded/whatever'd its arguments to create
>    something of that type, as it would require only one new function.

fwiw, I think it's about as unpythonish as it can be...

what other function takes an instance of an object to figure
out what object factory to call?  and why force people to make
a decision (list or tuple) that shouldn't matter in 99.9% of all
cases?  and wasn't this supposed to return a generator, not a
sequence object?

and "zip" is a pretty good name...  in most cases, it will be
perfectly clear from the context that it's not being used to
compress things (sure, "zip" is a command name that happens
to do something that this "zip" function won't do -- but the
same thing applies to "dir", "del", "copy", "type", just to name
a few...)

btw, doesn't numpy provide something like this?  reshape?

</F>