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


Groups > comp.lang.python > #92878

Re: instance as module

Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.005
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'defaults': 0.05; 'used.': 0.05; 'allowed.': 0.07; 'deprecated': 0.07; 'desirable.': 0.07; '__init__': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:module': 0.09; 'defaults.': 0.16; 'feasible': 0.16; 'itself;': 0.16; 'reason).': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; "someone's": 0.16; 'subject:instance': 0.16; 'wrote:': 0.16; 'string,': 0.18; 'fairly': 0.22; 'module': 0.23; 'import': 0.24; 'seems': 0.24; 'header:In-Reply-To:1': 0.24; 'all.': 0.24; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'define': 0.27; 'defining': 0.27; 'object,': 0.27; "i'm": 0.29; 'reset': 0.29; 'correct': 0.29; 'probably': 0.32; 'common': 0.33; 'running': 0.34; 'could': 0.35; 'to:addr:python-list': 0.35; 'ahead': 0.35; 'really': 0.35; 'problem.': 0.35; 'but': 0.36; 'being': 0.36; 'subject:: ': 0.37; 'received:org': 0.38; 'wanted': 0.39; 'things': 0.39; 'enough': 0.39; 'to:addr:python.org': 0.39; 'sure': 0.40; 'why': 0.40; 'even': 0.61; 'default': 0.61; 'more': 0.62; 'making': 0.64; 'situation': 0.67; 'special': 0.72; 'hoping': 0.73; 'received:109': 0.75; '..........': 0.84; 'becker': 0.84; 'bitten': 0.84; 'correctly?': 0.84; 'otten': 0.84; 'scatter': 0.84; 'processes,': 0.93
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Robin Becker <robin@reportlab.com>
Subject Re: instance as module
Date Fri, 19 Jun 2015 12:07:34 +0100
References <5583E0EA.2090309@chamonix.reportlab.co.uk> <mm0qig$a4d$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host 109.174.168.73
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
In-Reply-To <mm0qig$a4d$1@ger.gmane.org>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.631.1434712068.13271.python-list@python.org> (permalink)
Lines 37
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1434712068 news.xs4all.nl 2935 [2001:888:2000:d::a6]:34457
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:92878

Show key headers only | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web