From: Duncan Booth on
Neal Becker <ndbecker2(a)gmail.com> wrote:

> What I'm trying to do is make a callable whose behavior is switched
> based on some criteria that will be fixed for all calls. In my
> example, this will ultimately be determined by the setting of a
> command line switch.
>
If you want different behaviour its usually best to use different classes.

You can keep all the common behaviour in a base class and just override the
__call__ method for the different behaviour. Then use a factory function to
decide which class to instantiate or else override __new__ and make the
decision there. e.g.

>>> class X(object):
def __call__(self):
return 0
def __new__(cls, i):
if i!=0:
cls = Y
return object.__new__(cls)


>>> class Y(X):
def __call__(self):
return 1


>>> x = X(0)
>>> x()
0
>>> y = X(1)
>>> y()
1
>>> isinstance(x, X)
True
>>> isinstance(y, X)
True

P.S. I don't know what you did in your post but your Followup-To header is
pointing to a group on gmane which makes extra work for me replying. Please
don't do that.
From: Neal Becker on
Duncan Booth wrote:
....
>
> P.S. I don't know what you did in your post but your Followup-To header is
> pointing to a group on gmane which makes extra work for me replying.
> Please don't do that.

I'm sorry about that, there is some bad interaction between gmane's nntp-
smtp gateway and python's mail list. I don't know what to do about it. I
think the problem only happens on python's mail list (I've never seen it
reported on any of the MANY other lists I use via gmane).

From: Duncan Booth on
Neal Becker <ndbecker2(a)gmail.com> wrote:

> Duncan Booth wrote:
> ...
>>
>> P.S. I don't know what you did in your post but your Followup-To
>> header is pointing to a group on gmane which makes extra work for me
>> replying. Please don't do that.
>
> I'm sorry about that, there is some bad interaction between gmane's
> nntp- smtp gateway and python's mail list. I don't know what to do
> about it. I think the problem only happens on python's mail list
> (I've never seen it reported on any of the MANY other lists I use via
> gmane).
>
Are the other mailing lists gatewayed from Usenet? It may not matter if
there's a followup-to header on a mailing list, it probably just gets
ignored, but it does matter on Usenet (which after all is what Gmane is
emulating).
From: Neal Becker on
Duncan Booth wrote:

> Neal Becker <ndbecker2(a)gmail.com> wrote:
>
>> Duncan Booth wrote:
>> ...
>>>
>>> P.S. I don't know what you did in your post but your Followup-To
>>> header is pointing to a group on gmane which makes extra work for me
>>> replying. Please don't do that.
>>
>> I'm sorry about that, there is some bad interaction between gmane's
>> nntp- smtp gateway and python's mail list. I don't know what to do
>> about it. I think the problem only happens on python's mail list
>> (I've never seen it reported on any of the MANY other lists I use via
>> gmane).
>>
> Are the other mailing lists gatewayed from Usenet? It may not matter if
> there's a followup-to header on a mailing list, it probably just gets
> ignored, but it does matter on Usenet (which after all is what Gmane is
> emulating).

For the record, it isn't really gatewayed to usenet - it's just allowing you
to read your favorite ML via nntp - which is MUCH more sensible than
actually having all that mail delivered personally to you, if you read a lot
of lists.

From: Robert Kern on
On 2010-03-10 13:42 PM, Neal Becker wrote:
> Duncan Booth wrote:
>
>> Neal Becker<ndbecker2(a)gmail.com> wrote:
>>
>>> Duncan Booth wrote:
>>> ...
>>>>
>>>> P.S. I don't know what you did in your post but your Followup-To
>>>> header is pointing to a group on gmane which makes extra work for me
>>>> replying. Please don't do that.
>>>
>>> I'm sorry about that, there is some bad interaction between gmane's
>>> nntp- smtp gateway and python's mail list. I don't know what to do
>>> about it. I think the problem only happens on python's mail list
>>> (I've never seen it reported on any of the MANY other lists I use via
>>> gmane).
>>>
>> Are the other mailing lists gatewayed from Usenet? It may not matter if
>> there's a followup-to header on a mailing list, it probably just gets
>> ignored, but it does matter on Usenet (which after all is what Gmane is
>> emulating).
>
> For the record, it isn't really gatewayed to usenet - it's just allowing you
> to read your favorite ML via nntp - which is MUCH more sensible than
> actually having all that mail delivered personally to you, if you read a lot
> of lists.

python-list is also gatewayed to the real USENET group comp.lang.python in
addition to its GMane gateway. Duncan is reading comp.lang.python from a real
USENET server, not via python-list through his email client. Most of the other
lists you read via GMane aren't gatewayed to the real USENET, so your
Followup-To header never caused a problem for anyone else.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco