Op 2005-12-10, Devan L schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions could benefit. For instance suppose
you want to iterate over every second element in a list. Sure you
can use an extended
Op 2005-12-10, Brian Beck schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Will it ever be possible to write things like:
a = 4:9
I made a silly recipe to do something like this a while ago, not that
I'd recommend using it. But I also think it wouldn't be too far-fetched
to allow slice
Op 2005-12-11, Bengt Richter schreef [EMAIL PROTECTED]:
On 10 Dec 2005 12:07:12 -0800, Devan L [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions could benefit. For instance suppose
you want to iterate
Antoon Pardon wrote:
Suppose I have a list with 10 000 elements and I want
the sum of the first 100, the sum of the second 100 ...
One way to do that would be:
for i in xrange(0,1,100):
sum(itertools.islice(lst, i, i+100))
But itertools.islice would each time start from the
On 12 Dec 2005 08:34:37 GMT, Antoon Pardon [EMAIL PROTECTED] wrote:
Op 2005-12-10, Devan L schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions could benefit. For instance suppose
you want to iterate
Op 2005-12-12, Bengt Richter schreef [EMAIL PROTECTED]:
On 12 Dec 2005 08:34:37 GMT, Antoon Pardon [EMAIL PROTECTED] wrote:
Op 2005-12-10, Devan L schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions
Brian Beck wrote:
Antoon Pardon wrote:
Will it ever be possible to write things like:
a = 4:9
I made a silly recipe to do something like this a while ago, not that
I'd recommend using it. But I also think it wouldn't be too far-fetched
to allow slice creation using a syntax like the
On 2005-12-09, Duncan Booth [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
If the user can write
for key in tree['a':'b']:
then he can write:
for key in tree['a':'b'].iteritems():
No he can't. tree['a':'b'] would provide a list
of keys that all start with an 'a'. Such a list
Antoon Pardon wrote:
So lets agree that tree['a':'b'] would produce a subtree. Then
I still would prefer the possibility to do something like:
for key in tree.iterkeys('a':'b')
Instead of having to write
for key in tree['a':'b'].iterkeys()
Sure I can now do it like this:
for
Antoon Pardon wrote:
In general I use slices over a tree because I only want to iterate
over a specific subdomain of the keys. I'm not iterested in make
a tree over the subdomain. Making such a subtree would be an
enormous waste of resources.
Probably not unless you have really large data
On 2005-12-10, Steven Bethard [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
So lets agree that tree['a':'b'] would produce a subtree. Then
I still would prefer the possibility to do something like:
for key in tree.iterkeys('a':'b')
Instead of having to write
for key in
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
In general I use slices over a tree because I only want to iterate
over a specific subdomain of the keys. I'm not iterested in make
a tree over the subdomain. Making such a subtree would be an
enormous waste of
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions could benefit. For instance suppose
you want to iterate over every second element in a list. Sure you
can use an extended slice or use some kind of while. But why not
extend
Antoon Pardon wrote:
Will it ever be possible to write things like:
a = 4:9
I made a silly recipe to do something like this a while ago, not that
I'd recommend using it. But I also think it wouldn't be too far-fetched
to allow slice creation using a syntax like the above...
Antoon Pardon wrote:
On 2005-12-10, Steven Bethard [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
So lets agree that tree['a':'b'] would produce a subtree. Then
I still would prefer the possibility to do something like:
for key in tree.iterkeys('a':'b')
Instead of having to write
for key
On 10 Dec 2005 12:07:12 -0800, Devan L [EMAIL PROTECTED] wrote:
Antoon Pardon wrote:
On 2005-12-10, Duncan Booth [EMAIL PROTECTED] wrote:
[snip]
I also think that other functions could benefit. For instance suppose
you want to iterate over every second element in a list. Sure you
can use
Now slices are objects in python, I was wondering if slice
notation will be usable outside subscribtion in the future.
Will it ever be possible to write things like:
a = 4:9
for key, value in tree.items('alfa.': 'beta.'):
--
Antoon Pardon
--
Antoon Pardon wrote:
Now slices are objects in python, I was wondering if slice
notation will be usable outside subscribtion in the future.
Will it ever be possible to write things like:
a = 4:9
for key, value in tree.items('alfa.': 'beta.'):
Do you mean
for key, value in
Op 2005-12-09, Steve Holden schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Now slices are objects in python, I was wondering if slice
notation will be usable outside subscribtion in the future.
Will it ever be possible to write things like:
a = 4:9
for key, value in
Antoon Pardon wrote:
Will it ever be possible to write things like:
a = 4:9
for key, value in tree.items('alfa.': 'beta.'):
The first of these works fine, except you need to use the correct syntax:
a = slice(4,9)
range(10)[a]
[4, 5, 6, 7, 8]
The second also works fine, provide
Op 2005-12-09, Duncan Booth schreef [EMAIL PROTECTED]:
Antoon Pardon wrote:
Will it ever be possible to write things like:
a = 4:9
for key, value in tree.items('alfa.': 'beta.'):
The first of these works fine, except you need to use the correct syntax:
Sure, I know that. But why a
Antoon Pardon asked:
If we have lst = range(10), we can write
lst[slice(3,7)]
instead of
lst[3:7]
Now my impression is that should we only have the upper notation, slices
would be less usefull, because it would make using them more cumbersome.
Quite right, but the syntax for
Op 2005-12-09, Duncan Booth schreef [EMAIL PROTECTED]:
Antoon Pardon asked:
If we have lst = range(10), we can write
lst[slice(3,7)]
instead of
lst[3:7]
Now my impression is that should we only have the upper notation, slices
would be less usefull, because it would make
Antoon Pardon wrote:
If the user can write
for key in tree['a':'b']:
then he can write:
for key in tree['a':'b'].iteritems():
No he can't. tree['a':'b'] would provide a list
of keys that all start with an 'a'. Such a list
doesn't have an iteritems method. It wouldn't even
24 matches
Mail list logo