durusmail: quixote-users: Re: 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
Re: Illegal Python Names cookbook recipe
Graham Fawcett
2004-04-07
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



reply