On Tue, 29 Jul 2003 17:04:46 -0500
Evan Simpson <[EMAIL PROTECTED]> wrote:
> Jim Penny wrote:
> > But, what does all of this have to do with index:, key:, int:, etc.?
> > index: and key: are particularly interesting, in that they use
> > different syntax for something that python conflates syntactically.
> > That is, an integer indexed reference looks exactly like a string
> > indexed reference, both have form structure[key].
Well, that is exactly why it will be more confusing to everyone. A
python programmer is not expecting them to be different, and a
non-programmer has no idea of what keys and indices are, much less how
> I proposed distinct key: and item: in order to kill some implicit
> magic before it was born:
> "x/key:0" is the same as "python:x['0']", while "x/item:0" is the same
> as "python:x".
> It seems clear to me that subpath prefixes are going to be part of
> Zope 3, no matter how opinion on this thread goes. It wasn't hard to
> implement them for Zope 2, and I find them useful. While I agree that
> someone who can deal well with "x/item:0" will have no problem with
> "python:x", I also assert that many such people would join me in
> prefering "options/lib/data/my.sql/call:/item:0/state" to
> "options['lib'].data['my.sql']().state" if only because the former
> allows me to specify access methods *only* for the exceptions to the
> norm, not for every path step. If that isn't valuable, what about
> path expressions is?
Eeep, gad no. The python is horrible. The prefix syntax is equally
horrible, unfamiliar, and ambiguous! For example, why does call: not
have an argument, is it because my.sql is niladic, or is it that
'/item:0/state' is the argument? Is
"options/lib/data/call:my.sql/item:0/state" equivalent? Are parameters
magic? If not, how are they discovered?
> I also offer for general consideration the following:
> options/foo/item:0 | request/foo/item:0 | default
> data/stat/fmt:thousands_commas | string:No data.
> Python expression equivalents, please?
Yes, alternative is very nice. Yes, it can be done with python:path(),
or by refactoring the expression to an script. Yes, the alternatives
are harder to read, or more work. Nu?
The syntax has kind of odd denotation, on top of everything else. The
item:0 applies the integer indexing operator to the options['foo'] which
must be a sequence type with parameter 0? (I thought that was index: )
The fmt:thousands_commas construct applies the thousands_commas operator
with parameter data['stat']?
Doesn't it strike you as odd that sometimes the prefix denotes
parameterization, and sometimes it denotes application?
> Evan @ 4-am
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -