On Jun 10, 6:09 pm, Lie <[EMAIL PROTECTED]> wrote:
> On Jun 8, 11:11 pm, Mensanator <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Jun 8, 4:04 am, Lie <[EMAIL PROTECTED]> wrote:
>
> > > On Jun 8, 8:56 am, Mensanator <[EMAIL PROTECTED]> wrote:
>
> > > > On Jun 7, 8:22�pm, John Salerno <[EMAIL PROTECTED
On Jun 8, 11:11 pm, Mensanator <[EMAIL PROTECTED]> wrote:
> On Jun 8, 4:04 am, Lie <[EMAIL PROTECTED]> wrote:
>
>
>
> > On Jun 8, 8:56 am, Mensanator <[EMAIL PROTECTED]> wrote:
>
> > > On Jun 7, 8:22�pm, John Salerno <[EMAIL PROTECTED]> wrote:
>
> > > > Mensanator wrote:
> > > > > What I DID say wa
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Jun 8, 9:40 pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> Heh heh, don't worry. Every time I see a range function, I immediately
> think "creates a list". Not sure how I got into that habit, but it
> h
On Jun 9, 7:06 am, Ricardo Aráoz <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> > On Jun 6, 1:40 pm, The Pythonista <[EMAIL PROTECTED]> wrote:
> >> On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote:
> >>> Is it possible to write a list comprehension for this so as to produce a
> >>> list of
Mensanator wrote:
On Jun 6, 1:40 pm, The Pythonista <[EMAIL PROTECTED]> wrote:
On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote:
Is it possible to write a list comprehension for this so as to produce a
list of two-item tuples?
base_scores = range(8, 19)
score_costs = [0, 1, 1, 1, 1, 1, 1,
On Jun 8, 9:40 pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> > On Jun 8, 3:19�am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> >> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> >>news:[EMAIL PROTECTED]
> >> | On Jun 7, 6:43?pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> >>
Mensanator wrote:
On Jun 8, 3:19�am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Jun 7, 6:43?pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
| > zip(range(9,20), iterable)
|
| Oh, dear. You didn't actually try this,
On Jun 8, 4:04 am, Lie <[EMAIL PROTECTED]> wrote:
> On Jun 8, 8:56 am, Mensanator <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > On Jun 7, 8:22�pm, John Salerno <[EMAIL PROTECTED]> wrote:
>
> > > Mensanator wrote:
> > > > What I DID say was that how the builtins actually
> > > > work should be understood
On Jun 8, 3:19�am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | On Jun 7, 6:43?pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> | > zip(range(9,20), iterable)
> |
> | Oh, dear. You didn't actually try this, did you
On Jun 8, 8:56 am, Mensanator <[EMAIL PROTECTED]> wrote:
> On Jun 7, 8:22�pm, John Salerno <[EMAIL PROTECTED]> wrote:
>
> > Mensanator wrote:
> > > What I DID say was that how the builtins actually
> > > work should be understood and it APPEARED that the
> > > OP didn't understand that. Maybe he un
On Jun 8, 12:24 am, Mensanator <[EMAIL PROTECTED]> wrote:
> On Jun 7, 5:21�am, Paul Miller <[EMAIL PROTECTED]> wrote:
>
> > On Fri, 06 Jun 2008 18:01:45 -0700, Mensanator wrote:
> > > What happens if your iterables aren't the same length?
>
> > I chose not to consider that case,
>
> That's a bad ha
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Jun 7, 6:43?pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
| > zip(range(9,20), iterable)
|
| Oh, dear. You didn't actually try this, did you?
Works fine in Py3, which is what I use now.
--
http://mail.python.
On Jun 7, 8:22�pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> > What I DID say was that how the builtins actually
> > work should be understood and it APPEARED that the
> > OP didn't understand that. Maybe he understood that
> > all along but his example betrayed no evidence of
>
On Jun 7, 7:21 pm, Paul Miller <[EMAIL PROTECTED]> wrote:
> On Fri, 06 Jun 2008 18:01:45 -0700, Mensanator wrote:
> > What happens if your iterables aren't the same length?
>
> I chose not to consider that case, since they were the same length in the
> original post. Based on the variable names, i
Mensanator wrote:
What I DID say was that how the builtins actually
work should be understood and it APPEARED that the
OP didn't understand that. Maybe he understood that
all along but his example betrayed no evidence of
that understanding.
Well, the truth is that I know zip truncates to the s
On Jun 7, 6:43�pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "John Salerno" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]| Mensanator wrote:
>
> |
> | > Surely enumerate() wasn't added to Python with no intention of
> | > ever being used.
> |
> | I see your reasons for preferring
"John Salerno" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| Mensanator wrote:
|
| > Surely enumerate() wasn't added to Python with no intention of
| > ever being used.
|
| I see your reasons for preferring enumerate over zip, but I'm wondering
| if using enumerate this way isn't
On Jun 7, 1:16�pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Mensanator wrote:
> > Surely enumerate() wasn't added to Python with no intention of
> > ever being used.
>
> I see your reasons for preferring enumerate over zip,
It's not that I prefer it, it's that you specifically
asked a list compre
Mensanator wrote:
Surely enumerate() wasn't added to Python with no intention of
ever being used.
I see your reasons for preferring enumerate over zip, but I'm wondering
if using enumerate this way isn't a little hackish or artificial. Isn't
the point of enumerate to get the index of a speci
On Jun 7, 5:21�am, Paul Miller <[EMAIL PROTECTED]> wrote:
> On Fri, 06 Jun 2008 18:01:45 -0700, Mensanator wrote:
> > What happens if your iterables aren't the same length?
>
> I chose not to consider that case,
That's a bad habit to teach a newbie, isn't it?
> since they were the same length in
On Fri, 06 Jun 2008 18:01:45 -0700, Mensanator wrote:
> What happens if your iterables aren't the same length?
I chose not to consider that case, since they were the same length in the
original post. Based on the variable names, it seemed reasonable that
there would always be a 1-to-1 corresp
On Jun 6, 10:33 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> >news:[EMAIL PROTECTED]
> > |
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | On Jun 5, 10:42?pm, John Salerno <[EMAIL PROTECTED]> wrote:
> | > Is it possible
On Jun 6, 1:40 pm, The Pythonista <[EMAIL PROTECTED]> wrote:
> On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote:
> > Is it possible to write a list comprehension for this so as to produce a
> > list of two-item tuples?
>
> > base_scores = range(8, 19)
> > score_costs = [0, 1, 1, 1, 1, 1, 1, 2
On Jun 6, 3:19 pm, "John Salerno" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
> > "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> And since the OP foolishly
> hardcode
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
And since the OP foolishly
hardcoded his range bounds
Hmm, I just love the arrogance of some people. I actually
On Thu, 05 Jun 2008 23:42:07 -0400, John Salerno wrote:
> Is it possible to write a list comprehension for this so as to produce a
> list of two-item tuples?
>
> base_scores = range(8, 19)
> score_costs = [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3] print zip(base_scores,
> score_costs)
>
score_costs = [(
On Jun 6, 1:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | On Jun 5, 10:42?pm, John Salerno <[EMAIL PROTECTED]> wrote:
> | > Is it possible to write a list comprehension for this so as to produce
> a
> | > list of t
"Terry Reedy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> "Mensanator" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Which is exactly the purpose of zip, or its specialization enumerate!
Thanks guys! Looks like the simplest is always the best yet again! :)
On Thu, 05 Jun 2008 23:56:40 -0700, dwahli wrote:
> On Jun 6, 8:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>>
>> Of course, enumerate(iterable) is just a facade over zip(itertools.count(),
>> iterable)
>
> So you could write:
> gen = (x for x in itertools.izip(itertools.count(8), [0, 1, 1, 1
On Jun 6, 8:44 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
>
> Of course, enumerate(iterable) is just a facade over zip(itertools.count(),
> iterable)
So you could write:
gen = (x for x in itertools.izip(itertools.count(8), [0, 1, 1, 1, 1,
1, 1, 2, 2, 3, 3]))
print list(gen)
Using zip like you o
"Mensanator" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
| On Jun 5, 10:42?pm, John Salerno <[EMAIL PROTECTED]> wrote:
| > Is it possible to write a list comprehension for this so as to produce
a
| > list of two-item tuples?
| >
| > base_scores = range(8, 19)
| > score_costs = [0
On Jun 5, 10:42�pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Is it possible to write a list comprehension for this so as to produce a
> list of two-item tuples?
>
> base_scores = range(8, 19)
> score_costs = [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3]
> print zip(base_scores, score_costs)
>
> I can't think
Is it possible to write a list comprehension for this so as to produce a
list of two-item tuples?
base_scores = range(8, 19)
score_costs = [0, 1, 1, 1, 1, 1, 1, 2, 2, 3, 3]
print zip(base_scores, score_costs)
I can't think of how the structure of the list comprehension would work
in this case,
34 matches
Mail list logo