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


Groups > comp.lang.python > #33222

Getting module path string from a class instance

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <someukdeveloper@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.010
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'case.': 0.05; 'subject:Getting': 0.09; 'subject:module': 0.09; 'subject:string': 0.09; 'all?': 0.16; 'subject:class': 0.16; 'subject:instance': 0.16; 'string': 0.17; 'instance': 0.17; 'module': 0.19; 'trying': 0.21; 'received:192.168.1.100': 0.22; 'class.': 0.23; 'this:': 0.23; 'header:User-Agent:1': 0.26; 'received:209.85.212': 0.28; 'class': 0.29; "i'm": 0.29; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'equal': 0.33; 'received:google.com': 0.34; 'path': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'method': 0.36; 'does': 0.37; 'received:209': 0.37; 'advice': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'called': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'offer': 0.65
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=pmCDDSr2/xHiTqyky7VnTJCzInShJcw4t34r9ANotqY=; b=K3iyzSFAks+YeatWrApOk+lLZlqpqPiVikE/5AS3/GMMk7D3I/LRUHdVnmplF92jDQ N9ieH6FCZMeFDFX2wI5q46Id66CW1kpP5mHAb3UEe07CnyHozZBpbgIVCqSG0jx9CEw/ +CWnlnKAHok/fJBriR9nqW09Rko8806R/12qkgrPpsoQ6OzkvsIZjMU0wmw/54GyI7BA UCAFIZJwt7QZBUYMqZwf7w2j1bJQBYbKdwquBLSMqkQpjj+7NiTGzabJS84TKkwR7XO9 rpqivxRCRH8GkCLBIYR1GBqB+0MFv2qCBaTEneZ6nvr7JXOFo3Tt8DfFKWEkB7k5Nl8T rb3A==
Date Tue, 13 Nov 2012 06:38:31 +0000
From Some Developer <someukdeveloper@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 6.2; WOW64; rv:16.0) Gecko/20121026 Thunderbird/16.0.2
MIME-Version 1.0
To python-list@python.org
Subject Getting module path string from a class instance
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3611.1352788721.27098.python-list@python.org> (permalink)
Lines 8
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1352788721 news.xs4all.nl 6846 [2001:888:2000:d::a6]:37254
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:33222

Show key headers only | View raw


I'm trying to find a way to get a string of the module path of a class.

So for instance say I have class Foo and it is in a module called 
my.module. I want to be able to get a string that is equal to this: 
"my.module.Foo". I'm aware of the __repr__ method but it does not do 
what I want it to do in this case.

Can anyone offer any advice at all?

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


Thread

Getting module path string from a class instance Some Developer <someukdeveloper@gmail.com> - 2012-11-13 06:38 +0000
  Re: Getting module path string from a class instance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-13 07:19 +0000
    Re: Getting module path string from a class instance Some Developer <someukdeveloper@gmail.com> - 2012-11-13 07:54 +0000
      Re: Getting module path string from a class instance Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-11-13 08:49 +0000
        Re: Getting module path string from a class instance Some Developer <someukdeveloper@gmail.com> - 2012-11-13 16:15 +0000

csiph-web