Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92878 > unrolled thread

Re: instance as module

Started byRobin Becker <robin@reportlab.com>
First post2015-06-19 12:07 +0100
Last post2015-06-19 12:07 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: instance as module Robin Becker <robin@reportlab.com> - 2015-06-19 12:07 +0100

#92878 — Re: instance as module

FromRobin Becker <robin@reportlab.com>
Date2015-06-19 12:07 +0100
SubjectRe: instance as module
Message-ID<mailman.631.1434712068.13271.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web