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


Groups > comp.lang.python > #31809

Re: How to see the __name__ attribute of a class by using dir()

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <marco.buttu@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; 'subject:How': 0.09; 'python': 0.09; 'subject:()': 0.09; 'subject:using': 0.09; 'def': 0.10; 'metaclass': 0.16; 'subject:class': 0.16; 'wrote:': 0.17; 'specify': 0.17; 'pass': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'thanks!': 0.26; 'am,': 0.27; '>>>>': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'received:209.85': 0.35; 'message-id:@gmail.com': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'header:Received:5': 0.40; 'otten': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:newsgroups:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=snrUOR8zNpNzNJOuq+F6vL8liOdr79y3pY8X4JUZaHE=; b=clMbKRdeMTEjKgXZU4jNBk9XuE0lNpcn9+xCstIxbEC5wknPDctOOozHKCQZH9Mqo1 8PWvMINgdyKyajFQ4SgfEX5hQEQoTAREiTEdXi+IexNg2TJjpgt8tFRomoXmNib5Hgqu 2TR8kueNZPrwvDS0sy/oW+k9PH8b/TQmDRcVFnnOhNHDrgehxhCzOQZOujnYpmwk3CT7 UADQqFqjw/2QGYBv6t6Byh5Kj4wX0jbcqHbwpnl1+++0edhPQlCIZHyXLZB4n3I/6/aw /2XYxYBO3kAAfrTNzeIQy7ktVLItX1gwoLjh+FimNxJnb0own6SBMGnDX9aKANwdvyOb 9KIw==
Date Sat, 20 Oct 2012 13:19:05 +0200
From Jennie <marco.buttu@gmail.com>
User-Agent Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121011 Thunderbird/16.0.1
MIME-Version 1.0
Newsgroups comp.lang.python
To python-list@python.org
Subject Re: How to see the __name__ attribute of a class by using dir()
References <k5tm0k$sph$1@speranza.aioe.org> <mailman.2554.1350721484.27098.python-list@python.org> <508267F8.5030302@gmail.com> <mailman.2557.1350726214.27098.python-list@python.org>
In-Reply-To <mailman.2557.1350726214.27098.python-list@python.org>
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>
Message-ID <mailman.2559.1350731951.27098.python-list@python.org> (permalink)
Lines 18
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1350731951 news.xs4all.nl 6950 [2001:888:2000:d::a6]:48951
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:31809

Show key headers only | View raw


On 10/20/2012 11:43 AM, Peter Otten wrote:

> In Python 3 the way to specify the metaclass has changed:
>
>>>> class FooType(type):
> ...     def __dir__(self): return ["python"]
> ...
>>>> class Foo(metaclass=FooType):
> ...     pass
> ...
>>>> dir(Foo)
> ['python']

Thanks! :)


-- 
Jennie

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


Thread

How to see the __name__ attribute of a class by using dir() Jennie <nameDOTportua@gmail.com> - 2012-10-20 10:05 +0200
  Re: How to see the __name__ attribute of a class by using dir() Peter Otten <__peter__@web.de> - 2012-10-20 10:24 +0200
    Re: How to see the __name__ attribute of a class by using dir() Jennie <nameDOTportua@gmail.com> - 2012-10-20 10:59 +0200
      Re: How to see the __name__ attribute of a class by using dir() Peter Otten <__peter__@web.de> - 2012-10-20 11:43 +0200
        Re: How to see the __name__ attribute of a class by using dir() Jennie <nameDOTportua@gmail.com> - 2012-10-20 13:19 +0200
        Re: How to see the __name__ attribute of a class by using dir() Jennie <marco.buttu@gmail.com> - 2012-10-20 13:19 +0200
    Re: How to see the __name__ attribute of a class by using dir() Jennie <marco.buttu@gmail.com> - 2012-10-20 10:59 +0200

csiph-web