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:32:09PM -0500, Jason E. Sibre wrote:
> Great...  Now my ugly hack is immortalized! ;)

Well, feel free to nuke it in the wiki if you want. Doesn't make any
diff to me. :>

> Seriously, it may be worth pointing out that all three techniques have the
> same end result of adding the 'illegal-name' to the module's namespace.

Feel free to make that point, too!

> I forgot all about _q_resolve(), as I never use it...  But being reminded of
> it, I think that's your cleanest option, without considering the
> modification of the _q_exports logic.

Yes, absent changing _q_exports, _q_resolve is the best, by
far. *But*, it's not particularly good if you have more than, say, 4
or 5 static illegal names. Then you end up with an ugly if-elif-else
thing, and I hate maintaining those.

> Now, given: _q_exports = ['foo', 'bar', Alias('foo-bar', 'foo_bar')]

Sorta ugly syntactically, but not *bad*. It does avoid the type-check,
but I'm skeptical it will be any better performant.

> Or something like that...  Once resolved, it is permanently added to the
> correct namespace so that future checks have similar performance to the
> _q_resolve solution.

Hmm, interesting. But the performance comparison should be between yr
Alias and allowing rename tuples in _q_exports, I would think.

> Actually, a more conprehensive analysis may reveal that the check should be
> done sooner in the process, rather than at the last moment.

Yr Alias solution gets the explicit, arbitrary mapping back in, which
I like; but it's a bit more heavyweight syntactically than the literal
tuple. But I leave real analysis of performance and implementation
issues to those who know better.

Kendall
--
This sucks more than anything that has ever sucked before. -- Butthead


reply