[Python-Dev] accumulator display syntax
Alex Martelli
aleaxit at yahoo.com
Fri Oct 17 12:21:39 EDT 2003
On Friday 17 October 2003 06:12 pm, Skip Montanaro wrote:
> Greg> What you're proposing hijacks the indexing syntax and uses it to
> Greg> mean something completely different from indexing, which is a
> much Greg> bigger change, and potentially a very confusing one.
>
> Greg> So, no, sorry, it doesn't overcome my objection!
>
> I agree. Any expression bracketed by '[' and ']', no matter how many other
> clues to the ultimate result it might contain, ought to result in a list as
> far as I'm concerned.
Hmmm, how is, e.g.
foo[x*x for x in bar]
any more an "expression bracketed by [ and ]" than, say,
foo = {'wot': 'tow'}
foo['wot']
...? Yet the latter doesn't involve any lists that I can think of. Nor do
I see why the former need "mean something completely different from
indexing" -- it means to call foo's __getitem__ with the appropriately
constructed object, just as e.g. foo[ 'va':23:2j, {'zip':'zop'}:45:(3,4) ]
today calls it with a tuple of two weird slice objects (and doesn't
happen to involve any lists whatsoever).
Alex
More information about the Python-Dev
mailing list