On Thu, 9 Feb 2006 10:07:49 +1100, "Delaney, Timothy (Tim)" <[EMAIL PROTECTED]>
wrote:
>Steven D'Aprano wrote:
>
>> That's not a _reason_, it is just a (re-)statement of fact. We know
>> that defining a __call__ method on a module doesn't make it callable.
>> Why not? The answer isn't "because de
On Wed, 08 Feb 2006 07:14:04 -0500, Steve Holden wrote:
>>>Someone had to code Python so that it raised an error when you try to call
>>>a module object. Is there a reason why module() should not execute
>>>module.__call__()? I would have thought that by the duck typing principle,
>>>it shouldn't
Kent Johnson wrote:
> Antoon Pardon wrote:
>> This make me wonder. Would it be possible to do something with
>> metaclasses so that after
>>
>> class SomeClass(MetaClass):
>> ...
>>
>> SomeClass() will be equivalent to MetaClass.__call__(SomeClass)
>
> I think that's already what happ
Antoon Pardon wrote:
> This make me wonder. Would it be possible to do something with
> metaclasses so that after
>
> class SomeClass(MetaClass):
> ...
>
> SomeClass() will be equivalent to MetaClass.__call__(SomeClass)
I think that's already what happens. IIUC type.__call__ implem
Steve Holden <[EMAIL PROTECTED]> writes:
> Right. While we're at it, why don't we make strings callable. Calling
> a string could call the function whose name (in some namespace or
> other) was in the string.
Making a string subclass callable works fine:
>>> class f(str):
... def __cal
Op 2006-02-08, Scott David Daniels schreef <[EMAIL PROTECTED]>:
> Steven D'Aprano wrote:
>> On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
>>
>>> adam johnson wrote:
>>>
Hi All.
I was wondering why defining a __call__ attribute for a module
doesn't make it actuall
Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>:
> Antoon Pardon wrote:
>> Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>:
>>
>>>Why should a module be callable? What's the advantage? Should we be able
>>>to add two modules together, yielding a module that contains all the
>>>co
Steven D'Aprano wrote:
> That's not a _reason_, it is just a (re-)statement of fact. We know
> that defining a __call__ method on a module doesn't make it callable.
> Why not? The answer isn't "because defining a __call__ method on a
> module or an instance doesn't make it callable", that's just a
Antoon Pardon wrote:
> Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>:
>
>>Why should a module be callable? What's the advantage? Should we be able
>>to add two modules together, yielding a module that contains all the
>>code of both modules? What happens if I multiply a module by two -
Steven D'Aprano wrote:
> On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
>
>> adam johnson wrote:
>>
>>> Hi All.
>>> I was wondering why defining a __call__ attribute for a module
>>> doesn't make it actually callable.
>> For the same reason that the following doesn't work
> [sn
Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>:
>
> Why should a module be callable? What's the advantage? Should we be able
> to add two modules together, yielding a module that contains all the
> code of both modules? What happens if I multiply a module by two -
> presumably the resul
Op 2006-02-08, Steve Holden schreef <[EMAIL PROTECTED]>:
> Fuzzyman wrote:
>> Steve Holden wrote:
> [...]
>>>
>>>The pursuit of orthogonality, while admirable, can lead to insanity if
>>>pushed too far.
>>>
>>
>>
>> Sure - feel free to venture as far down the road of insanity as you
>> like :-) T
Steve Holden wrote:
(snip)
> The pursuit of orthogonality, while admirable, can lead to insanity if
> pushed too far.
>
+1 QOTW
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in '[EMAIL PROTECTED]'.split('@')])"
--
http://mail.python.org/mailm
Fuzzyman wrote:
> Steve Holden wrote:
[...]
>>
>>The pursuit of orthogonality, while admirable, can lead to insanity if
>>pushed too far.
>>
>
>
> Sure - feel free to venture as far down the road of insanity as you
> like :-) To pursue your analogy, why don't we answer all usenet posts
> by pushi
Steve Holden wrote:
> Fuzzyman wrote:
> > Steven D'Aprano wrote:
> >
> >>On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
> >>
> >>
> >>>adam johnson wrote:
> >>>
> >>>
> Hi All.
> I was wondering why defining a __call__ attribute for a module
> doesn't make it actuall
Fuzzyman wrote:
> Steven D'Aprano wrote:
>
>>On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
>>
>>
>>>adam johnson wrote:
>>>
>>>
Hi All.
I was wondering why defining a __call__ attribute for a module
doesn't make it actually callable.
>>>
>>>For the same reason that
Steven D'Aprano wrote:
> On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
>
> > adam johnson wrote:
> >
> >> Hi All.
> >> I was wondering why defining a __call__ attribute for a module
> >> doesn't make it actually callable.
> >
> > For the same reason that the following doesn't w
On Wed, 08 Feb 2006 13:58:13 +1100, Delaney, Timothy (Tim) wrote:
> adam johnson wrote:
>
>> Hi All.
>> I was wondering why defining a __call__ attribute for a module
>> doesn't make it actually callable.
>
> For the same reason that the following doesn't work
[snip example]
> The __call__ attr
On 2/8/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote:
> limodou wrote:
>
> > On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote:
> >> Thanks for you answer.
> >>
> >> I was under the impression that you could tack methods onto an
> >> object at any time, your example almost works with old sty
limodou wrote:
> On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote:
>> Thanks for you answer.
>>
>> I was under the impression that you could tack methods onto an
>> object at any time, your example almost works with old style classes
>> and would with a function instead of a method.
In fact it
On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote:
> Thanks for you answer.
>
> I was under the impression that you could tack methods onto an object at any
> time, your example almost works with old style classes and would with a
> function instead of a method.
>
> >>> class A:
> ... def __ini
Thanks for you answer.I was under the impression that you could tack methods onto an object at any time, your example almost works with old style classes and would with a function instead of a method.>>> class A:
... def __init__(self):... self.__call__ = A.hello... def hello(se
On 2/8/06, Delaney, Timothy (Tim) <[EMAIL PROTECTED]> wrote:
> adam johnson wrote:
>
> > Hi All.
> > I was wondering why defining a __call__ attribute for a module
> > doesn't make it actually callable.
>
> For the same reason that the following doesn't work
>
> class A (object):
>
> de
adam johnson wrote:
> Hi All.
> I was wondering why defining a __call__ attribute for a module
> doesn't make it actually callable.
For the same reason that the following doesn't work
class A (object):
def __init__(self):
self.__call__ = A.hello
def hello (self
On 2/8/06, adam johnson <[EMAIL PROTECTED]> wrote:
> Hi All.
> I was wondering why defining a __call__ attribute for a module doesn't make
> it actually callable.
>
> I don't have any reason for doing so, I was just wondering if it worked, and
> found out it didn't.
>
> $ cat mod.py
> """
> Test ca
25 matches
Mail list logo