-----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-----