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


Groups > comp.lang.python > #9026

Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead)

From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead)
Followup-To comp.lang.python
Date 2011-07-07 14:50 +0200
Organization None
Message-ID <iv4a23$f53$1@solani.org> (permalink)
References <38cc43c2-7f4d-4b30-9260-cc439fc7000a@a10g2000vbz.googlegroups.com> <mailman.735.1310029448.1164.python-list@python.org>

Followups directed to: comp.lang.python

Show all headers | View raw


Peter Otten wrote:

> or you wrap the callable in a descriptor:
> 
>>>> def DefaultTracer(*args): print args
> ...
>>>> class D(object):
> ...     def __init__(self, f):
> ...             self.f = f
> ...     def __get__(self, *args):
> ...             return self.f
> ...

After skimming over Steven's post: use staticmethod.
No idea why I didn't think of that myself.

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


Thread

TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Kannan Varadhan <kvaradhan3@gmail.com> - 2011-07-07 01:08 -0700
  Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Peter Otten <__peter__@web.de> - 2011-07-07 11:04 +0200
    Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Peter Otten <__peter__@web.de> - 2011-07-07 14:50 +0200
      Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Kannan Varadhan <kvaradhan3@gmail.com> - 2011-07-10 19:13 -0700
  Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-07 22:36 +1000
    Re: TypeError: unbound method DefaultTracer() must be called with MyClass instance as first argument (got str instance instead) Paul Rudin <paul.nospam@rudin.co.uk> - 2011-07-07 13:38 +0100

csiph-web