Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Getting module path string from a class instance

Received: by 10.66.86.102 with SMTP id o6mr8517022paz.41.1352788722570;
        Mon, 12 Nov 2012 22:38:42 -0800 (PST)
Path: s9ni8701pbb.0!nntp.google.com!news.glorb.com!3.us.feeder.erje.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: <someukdevelo...@gmail.com>
X-Original-To: python-l...@python.org
Delivered-To: python-l...@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 <someukdevelo...@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-l...@python.org
Subject: Getting module path string from a class instance
X-BeenThere: python-l...@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-requ...@python.org?subject=unsubscribe>
List-Archive: <http://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-l...@python.org>
List-Help: <mailto:python-list-requ...@python.org?subject=help>
List-Subscribe: <http://mail.python.org/mailman/listinfo/python-list>,
	<mailto:python-list-requ...@python.org?subject=subscribe>
Newsgroups: comp.lang.python
Message-ID: <mailman.3611.1352788721.27098.python-l...@python.org>
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: ab...@xs4all.nl
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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?