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
Tom Jenkins
2004-04-07
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Graham Fawcett wrote:

| But having said that, is there anything particularly wrong with this?
|
|
|      import foo, bar, baz
|      import _twenty_foo, _twelve_bar, _shebang
|
|
|      _q_exports = ['foo', 'bar', 'baz']
|
|      _other_exports = {
|          '20foo':    _twenty_foo,
|          '12bar':    _twelve_bar,
|          '#!':       _shebang,
|      }
|
|
|      def _q_resolve(name):
|          return _other_exports.get(name)
|
|      ...
|
| 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!

and then I read the way that _q_resolve works.  To get the above to work
the Publisher's _get_component flow would have to change a bit:
if hasattr(container, component):
~   
elif hasattr(container, "_q_resolve"):
~   
elif (component != "_q_index" and component not in container._q_exports):
~   
... the others can remain the same ...

- --
Tom Jenkins
devIS - Development Infostructure
http://www.devis.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0-nr2 (Windows XP)
Comment: Using GnuPG with MultiZilla - http://enigmail.mozdev.org

iD8DBQFAdC8XV7Yk9/McDYURAivzAJwK8o+C98s3XJyElCoh2mAi5iLm4ACfVQui
j4uoPNLH+sC56xCjFXHgtaY=
=jmkj
-----END PGP SIGNATURE-----



reply