On Tue, Apr 06, 2004 at 09:58:40PM -0400, A.M. Kuchling wrote:
> Possible solution: _q_map is automatically created the first time you
> traverse through an object. If the object already has a _q_map, the
> contents of _q_exports are merged into _q_map. So you could include one,
> the other, or both as you see fit.
>
> One worry: mutating _q_map could lead to confusion. Python doesn't have an
> immutable dictionary type (unless Raymond Hettinger went and added one).
Compared to Neil's patch and the change to _q_exports it provides,
this _q_map interacting with _q_exports seems *far* more complex to
me.
That having been said, I'm not a Quixote core developer, so
implementational complexity is not really my primary concern. Insofar
as I understand Andrew's proposal, I could live with it, I think. At
least, it's better than using _q_lookup or _q_resolve in some cases.
But what would _q_map look like?
1. A list of mapping tuples:
_q_map = [("style.css", "style_css"), ("rdf-model", "rdf_model")]
1a. A tuple of mapping tuples:
_q_map = (("style.css", "style_css"), ("rdf-model", "rdf_model"))
Which is in keeping with the way GvR distinguishes lists from tuples
(err, I think) and gives you some assurance that it won't be
accidentally mutated behind yr back, though I have no idea if that's
workable.
2. A list (or tuple) of explicit dicts:
_q_map = [ {"public": "style.css", "private": "style_css"},
{"public": "rdf-model", "private": "rdf_model"} ]
(Other key name possibilities: "internal"/"external", "URI"/"Py". I'd
probably declare a global constant somewhere so that I could do: {PUB:
"style.css", PRIV: "style_css"} but YTMV.)
3. A dict:
_q_map = {"style.css": "style_css", "rdf-model": "rdf_model"}
Of course,
- for those who worry about implicitness, you have to remember the
mapping order with (1), (1a), and (3). Only (2) or (2a) make it
explicit
- we would have *two* mechanisms for doing what is essentially the
same mapping operation
- what is the semantics when identical items appear in exports and
map?
Best,
Kendall Clark
--
Jazz is only what you are. --Louis Armstrong