instance as module
Robin Becker
robin at reportlab.com
Fri Jun 19 07:07:34 EDT 2015
On 19/06/2015 11:23, Peter Otten wrote:
> Robin Becker wrote:
.........
>
> Do I understand this correctly? You got bitten by a complex setup and now
> you are hoping to improve the situation by making it even more complex?
>
> How about reordering initialisation in such a way that the user defaults are
> the last thing being set?
>
I don't think re-ordering is feasible or desirable.
For the specific case of the canvas_basefontname I don't actually need to do
anything specific since it is just a string, however, before it can be used in
action support has to be provided ie I must register the font used. I could just
make the few usages of this value check for callability at use time, but that
would scatter the problem; if one default is special why not all.
Effectively the defaults setup is not complex enough to allow use of itself;
that must be a fairly common problem.
Probably the correct thing to do was always to use an object to hold the
defaults. For a long time a module satisfied, then people wanted long running
processes, reset etc etc now they want to define things ahead of time (probably
for good reason).
I could just move the rl_config module into reportlab's __init__ as an object,
but I'm almost sure that would break someone's
from reportlab.rl_config import *
which although deprecated is still allowed. Defining a module like object seems
a reasonable way out if I really need it.
--
Robin Becker
More information about the Python-list
mailing list