slice notation as values?

Antoon Pardon apardon at forel.vub.ac.be
Fri Dec 9 07:17:21 EST 2005


Op 2005-12-09, Steve Holden schreef <steve at holdenweb.com>:
> 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 tree.items()['alfa.': 'beta.']:

No, the slice is meant to be a parameter to the method.
It would be a more convenient way to write:

  for key, value in tree.items(slice('alfa.', 'beta.'))

-- 
Antoon Pardon



More information about the Python-list mailing list