Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #31803
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.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 | <marco.buttu@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.009 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; '(python': 0.05; 'modify': 0.05; 'subject:How': 0.09; 'subject:()': 0.09; 'subject:using': 0.09; 'def': 0.10; '...]': 0.16; 'subject:class': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'skip:_ 20': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'skip:[ 10': 0.26; 'am,': 0.27; '>>>>': 0.29; 'skip:_ 10': 0.29; 'class': 0.29; "skip:' 10": 0.30; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'but': 0.36; 'message- id:@gmail.com': 0.36; 'does': 0.37; '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; 'your': 0.60; 'otten': 0.84; 'peter,': 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=RyGxM4YO0x6T0//6TKhspRxO2IJpEtVoZ+rH39o27nA=; b=wGDnRAn1LFPss1QB0BHwaVv7KsjsN92lIFt+hxmxGYG/faKp2uV5j65KiO4P1GP2Ts AFFiioNVFkwQB7ZtCSS1wymAwPxG3vtMAazweChk7o3MKnJOLZNGzM1JHi2PCZ2LOxA4 tGmzQX0hWixWKimdGjw+9yyHgKGZrteAuqzjbHxKMCUGQpfINPMjQ99kIFwyxpGoVxHQ a3OcPcVMeHysBw7gp8ZQs8VuCqm568fa8WXok9LxlumbtE1pYFm6J43Lo8mxd8aIZwIj OmUR12OEdvLCObVUh2NqSzJEA6buEiUW/gddEfhALXTpVIWhh/w0OefoAKPfPrXn8Fxx oFUw== |
| Date | Sat, 20 Oct 2012 10:59:36 +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> |
| In-Reply-To | <mailman.2554.1350721484.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.2555.1350723588.27098.python-list@python.org> (permalink) |
| Lines | 25 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1350723588 news.xs4all.nl 6926 [2001:888:2000:d::a6]:51018 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:31803 |
Show key headers only | View raw
On 10/20/2012 10:24 AM, Peter Otten wrote: > So if you want to customise dir(Foo) you have to modify the metaclass: > >>>> >>>class Foo: > ... class __metaclass__(type): > ... def __dir__(self): return ["python"] > ... >>>> >>>dir(Foo) > ['python'] > > Hi Peter, thanks for your answer, but it does not work (Python 3.3): >>> class Foo: ... class __metaclass__(type): ... def __dir__(self): return ["python"] ... >>> dir(Foo) ['__class__', '__delattr__', '__dict__', '__dir__', ...] Regards, -- Jennie
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll 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