"Lasse Vågsæther Karlsen" <[EMAIL PROTECTED]> wrote:

> So what you're saying is that instead of:
>
> def fn(*values, **options):
>
> I should use:
>
> def fn(values, cmp=cmp):
>
> in this specific case?
>
> and then instead of:
>
> fn(1, 2, 3, cmp=...)
>
> this:
>
> fn([1, 2, 3], cmp=...)
>
> <snip>
>
> I think I'll re-write to use a list instead

Actually in most cases you don't need to assume it's a list; any
iterable is usually good enough. You can always turn it into a list (or
a tuple or a set or..) in the function if you really have to. So when
you do have to and when you don't ? You don't have to if all you do is
iterate over the elements. This is true even if you want to iterate
more than once; just use the itertools.tee() function to create N
independent iterators. To sum up, a better signature for your function
is likely to be "def fn(iterable, cmp=cmp)".

George

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to