Tom Jenkins wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Graham Fawcett wrote:
>
> | But having said that, is there anything particularly wrong with this?
> |
> | It's clean, explicit, declarative, easy to type, and has a nice
> | idiomatic feel about it, don't you think? I would happy reading this in
> | someone's code, or writing it in mine.
>
> I'm going to agree with Graham (and company) on this one. I find this
> much more readable than embedded tuples in the _q_exports.
>
> But does it work? I can not get the above to work.
>
> DOH!
DOH is right! Sorry about that. I forgot that _q_resolve still requires
that the name to be resolved is part of the _q_exports list.
Here's a short example that really works, with no changes to Publisher:
import _dollar_one, foo, bar
_q_exports = ['foo', 'bar']
_other_exports = {
'$one': _dollar_one,
}
_q_exports.extend(_other_exports.keys())
def _q_resolve(name):
return _other_exports.get(name)
I actually tried this one before posting it to the list. :-;
-- Graham