James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
>i = start
>for it in itrbl:
> yield (i, it)
> i += step
I proposed something like this long ago and Guido has already rejected
it. Part of the reason
On Mon, 30 Oct 2006 23:42:16 +, Steve Holden wrote:
> Divorce is obviously the only answer. How could you end up marrying
> someone who counts from one and not zero? ;-)
"Should array indices start at 0 or 1? My compromise of 0.5 was rejected
without, I thought, proper consideration." (Stan
James Stroud wrote:
> Steve Holden wrote:
> > How could you end up marrying
> > someone who counts from one and not zero? ;-)
>
> She's the only other person I've ever met who used vi key binding at the
> command line.
>
Wow. Now I see!
It's only Python. Just add one to indices where appropriate,
Mark Elston <[EMAIL PROTECTED]> writes:
> * James Stroud wrote (on 10/30/2006 4:39 PM):
> > She's the only other person I've ever met who used vi key binding
> > at the command line.
>
> Well, there's your problem. You need to C-x C-f a new mate. :)
I don't have the commitment for that. What if
* James Stroud wrote (on 10/30/2006 4:39 PM):
> Steve Holden wrote:
>> How could you end up marrying someone who counts from one and not
>> zero? ;-)
>
> She's the only other person I've ever met who used vi key binding at the
> command line.
>
> James
>
>
Well, there's your problem. You ne
Steve Holden wrote:
> How could you end up marrying
> someone who counts from one and not zero? ;-)
She's the only other person I've ever met who used vi key binding at the
command line.
James
--
James Stroud
UCLA-DOE Institute for Genomics and Proteomics
Box 951570
Los Angeles, CA 90095
ht
James Stroud wrote:
> Diez B. Roggisch wrote:
>
>>>Okay, I've googled "leaky abstractions" (as was probably your intended
>>>affect with your silence), read the famous essay, and still
>>>don't know what you mean and how it applies to what I have described.
>>>
>>>Do you plan to justify your state
Diez B. Roggisch wrote:
>> Okay, I've googled "leaky abstractions" (as was probably your intended
>> affect with your silence), read the famous essay, and still
>> don't know what you mean and how it applies to what I have described.
>>
>> Do you plan to justify your statement or emptily accuse peo
> Okay, I've googled "leaky abstractions" (as was probably your intended
> affect with your silence), read the famous essay, and still
> don't know what you mean and how it applies to what I have described.
>
> Do you plan to justify your statement or emptily accuse people of violating
> esoteric
Ben Finney wrote:
>
> >>> def obstinate_economist_enumerate(items):
> ... enum_iter = iter((i+1, x) for (i, x) in enumerate(items))
> ... return enum_iter
iter is redundant here.
def natural_enumerate_improvement(items, start=0):
return ((i+start, x) for (i, x) in enumer
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
Okay, I've googled "leaky abstractions" (as was probably y
Ben Finney <[EMAIL PROTECTED]> writes:
> >>> print enumerate("ABCDE")
>
> >>> print list(enumerate("ABCDE"))
> [(0, 'A'), (1, 'B'), (2, 'C'), (3, 'D'), (4, 'E')]
>
> >> def obstinate_economist_enumerate(items):
> ... seq = [(i+1, x) for (i, x) in enumerate(items)]
>
James Stroud <[EMAIL PROTECTED]> writes:
> Fredrik Lundh wrote:
> > why is it this function's job to add an offset to the actual
> > sequence index?
>
> The code is for an economist. She is insistent on starting with the
> first bin as 1.
Note that 'enumerate' is actually a built-in type, and 'en
James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
>i = start
>for it in itrbl:
> yield (i, it)
> i += step
>
> This allows much more flexibility than in the current enumerate,
> tightens up code in m
James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
>i = start
>for it in itrbl:
> yield (i, it)
> i += step
>
> This allows much more flexibility than in the current enumerate,
> tightens up code in m
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> The code is for an economist. She is insistent on starting with the
>> first bin as 1.
>
> leaky abstractions in reverse, in other words? that's not a good design
> approach.
>
>
>
I'm not sure I understand what "leaky abstractions" means.
I
James Stroud wrote:
> The code is for an economist. She is insistent on starting with the
> first bin as 1.
leaky abstractions in reverse, in other words? that's not a good design
approach.
--
http://mail.python.org/mailman/listinfo/python-list
Fredrik Lundh wrote:
> James Stroud wrote:
>
>> def enumerate(itrbl, start=0, step=1):
>>i = start
>>for it in itrbl:
>> yield (i, it)
>> i += step
>
> that's spelled
>
> izip(count(start), sequence)
>
> in today's Python.
>
> > def in_interval(test, bounds, first=1, rev
Fredrik Lundh wrote:
> why is it this function's job to add an offset to the actual sequence
> index?
>
>
The code is for an economist. She is insistent on starting with the
first bin as 1. I'm guessing, practically, binning linerizes data and
the bin number may potentially become a divisor o
James Stroud wrote:
> def enumerate(itrbl, start=0, step=1):
>i = start
>for it in itrbl:
> yield (i, it)
> i += step
that's spelled
izip(count(start), sequence)
in today's Python.
> def in_interval(test, bounds, first=1, reverse=False):
why is it this function's job t
James Stroud wrote:
> I think that it would be handy for enumerate to behave as such:
>
> def enumerate(itrbl, start=0, step=1):
> i = start
> for it in itrbl:
> yield (i, it)
> i += step
>
> This allows much more flexibility than in the current enumerate,
> tightens up code in many
I think that it would be handy for enumerate to behave as such:
def enumerate(itrbl, start=0, step=1):
i = start
for it in itrbl:
yield (i, it)
i += step
This allows much more flexibility than in the current enumerate,
tightens up code in many cases, and seems that it would break
22 matches
Mail list logo