John Machin wrote:
> On May 3, 8:55 am, Steven D'Aprano
> <[EMAIL PROTECTED]> wrote:
>> On Wed, 02 May 2007 15:03:24 -0700, Tobiah wrote:
>>
>>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
>>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>> Wow! That's impressive. What version of Python are you usin
John Machin wrote:
> On May 3, 10:21 am, Michael Hoffman <[EMAIL PROTECTED]> wrote:
>> Tobiah wrote:
>>
>>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
>>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>> That's not an array, it's a list. See the array module for arrays
>> (fixed-length, unlike varia
On Wed, 02 May 2007 16:01:05 -0700, John Machin wrote:
> The OP has already confessed. Don't rub it in.
Sorry, I sent my comment before I received his confession.
--
Steven D'Aprano
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
>
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
>
Here's one I use:
def elegant_solution(alist):
i = iter(alist)
return [[j, i.next()] for j in i]
py> elegant_solution(range(14))
[[0, 1], [2, 3], [4, 5], [6, 7], [8, 9], [10,
On May 3, 10:21 am, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> Tobiah wrote:
>
> > >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> > [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
> That's not an array, it's a list. See the array module for arrays
> (fixed-length, unlike variable-length lists).
You
Tobiah wrote:
>
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
That's not an array, it's a list. See the array module for arrays
(fixed-length, unlike variable-length lists).
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Yeah, having an elegant_solution() function would solve soo many of my
problems. ;)
Ian
--
http://mail.python.org/mailman/listinfo/python-list
On May 3, 8:55 am, Steven D'Aprano
<[EMAIL PROTECTED]> wrote:
> On Wed, 02 May 2007 15:03:24 -0700, Tobiah wrote:
>
> > >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> > [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
> Wow! That's impressive. What version of Python are you using? When I try
> it, I ge
On Wed, 02 May 2007 15:03:24 -0700, Tobiah wrote:
>
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
Wow! That's impressive. What version of Python are you using? When I try
it, I get this:
>>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
Traceback (most r
I'm a retard. Disregard.
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> On May 3, 8:03 am, Tobiah <[EMAIL PROTECTED]> wrote:
>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>>
>
> What is your definition of "elegant"? What about other dimensions of
> code quality like "robust" and "fast"?
>
> What hav
Matimus wrote:
> On May 2, 3:03 pm, Tobiah <[EMAIL PROTECTED]> wrote:
>> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
>> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>>
>> --
>> Posted via a free Usenet account fromhttp://www.teranews.com
>
seq = range(1,11)
seq
> [1, 2, 3, 4, 5, 6, 7, 8,
On May 3, 8:03 am, Tobiah <[EMAIL PROTECTED]> wrote:
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
What is your definition of "elegant"? What about other dimensions of
code quality like "robust" and "fast"?
What have you tried?
Here's one possibili
On May 2, 3:03 pm, Tobiah <[EMAIL PROTECTED]> wrote:
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
> --
> Posted via a free Usenet account fromhttp://www.teranews.com
>>> seq = range(1,11)
>>> seq
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> zip( seq[0::2],se
>>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
[[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
--
Posted via a free Usenet account from http://www.teranews.com
--
http://mail.python.org/mailman/listinfo/python-list
15 matches
Mail list logo