durusmail: quixote-users: Illegal Python Names cookbook recipe
Illegal Python Names cookbook recipe
2004-04-05
2004-04-05
2004-04-05
Bug fixes (was: Illegal Python Names cookbook recipe)
2004-04-07
2004-04-07
Bug fixes (was: Illegal Python Names cookbookrecipe)
2004-04-07
Patches for .7a3
2004-04-07
Re: Patches for .7a3
2004-04-08
StaticFile is broken (Quixote-0.7a3, scgi-1.2a2, Apache/1.3.27, FreeBSD 4.7)
2004-04-08
Re: Patches for .7a3
2004-04-21
2004-04-21
2004-04-06
2004-04-06
2004-04-06
2004-04-06
2004-04-06
2004-04-06
2004-04-06
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
Re: Illegal Python Names cookbook recipe
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-07
2004-04-08
2004-04-07
2004-04-07
2004-04-07
2004-04-06
2004-04-05
2004-04-05
2004-04-05
Re: R: [Quixote-users] Illegal Python Names cookbook recipe
2004-04-06
Illegal Python Names cookbook recipe
Kendall Clark
2004-04-05
On Mon, Apr 05, 2004 at 04:31:11PM -0400, Neil Schemenauer wrote:

> An interesting idea.  A dict is a bit of overkill since I don't
> think it should have more than one entry.  Perhaps a tuple:

Ah, yes, a tuple is better. The point is just to reintroduce the idea
of explicit *mapping* to _q_exports, since that's what it really wants
to be (well, IMO). Disquoting is fine, since it's the common case, but
it's not the only one.

>     _q_exports = ["foo", "bar", ("rdf-model", rdf_model), "baz"]

I could v. easily live w/ that.

> Alternatively, we could have it be purely a rename:
>
>     _q_exports = ["foo", "bar", ("rdf-model", "rdf_model"), "baz"]

Yes, I suspect this changes existing code less. In fact, this is
better than the previous, at the cost of typing 2 extra characters,
because it is likely to be a less invasive change.

> 'rdf_model' would then be looked up the normal way (e.g. it could be
> a package or module).  Another advantage is that you can keep
> _q_exports at the top of the module.  I'm not sure if I like it
> better than the direct function reference version though.

I lean toward the rename rather than direct callable embedding in the
tuple. That's too different than the existing semantics of _q_exports
as I understand it.

My larger point is that either one is a better solution to the URI-Py id
mismatch than doing _q_resolve() or _q_lookup().

In the case where you have many static illegal Py identifiers you want
to export, either the resolve or lookup function solutions require a
crufty if-elif-else thing (or some other bit of mess), when you really
just want an explicit arbitrary name-to-name mapping, rather than the
default disquotation mapping.

Best,
Kendall Clark


reply