[Zope-dev] Re: TALES idea: tuple unpacking
Shane Hathaway
shane@zope.com
Wed, 23 Jul 2003 13:24:32 -0400
(I'm cc'ing zope-dev this time)
Evan Simpson wrote:
> Jim Penny wrote:
>
>> Hate this. Looks like a typecast of some kind, int is way to overused
>> for this. If you must, why not index: ?
>
>
> Hmmm. I hadn't thought of that before, but I've certainly wanted to
> tell the path traverser whether to use attribute, index, or key access
> on several occasions (using 'items' as a dictionary key bites me
> regularly). This suggests the following prefixes:
>
> 'key:' -- use item access with the prefixed string.
> 'index:' -- use item access with the prefixed integer.
> 'attr:' -- use attribute access with the prefixed string.
I agree, "index:" is better. I had a mental block that made me think of
only "item:", which would be ambiguous.
Shane