Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9363
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!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 | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'plenty': 0.04; 'args': 0.05; '#define': 0.09; '>>>>': 0.09; 'wed,': 0.12; 'am,': 0.13; 'wrote:': 0.15; 'advocating': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'rantingrick': 0.16; 'subject:() ': 0.16; 'subject:function': 0.16; 'received:209.85.210.174': 0.19; 'received:mail-iy0-f174.google.com': 0.19; 'header:In-Reply- To:1': 0.22; 'once.': 0.23; 'problem?': 0.23; 'code': 0.24; 'message-id:@mail.gmail.com': 0.28; 'granted,': 0.30; 'to:addr :python-list': 0.34; 'there': 0.34; '(for': 0.36; 'but': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.38; 'room': 0.38; 'run': 0.39; 'to:addr:python.org': 0.39; 'received:209': 0.40; 'your': 0.60 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=3/CLnJaOjSvph4F38U8WPdGbO8fDZfGdVIO3d49ea0Q=; b=BustsrYSI0DRhT0cUtJbzcaoti3OceUx7vXSt0eKCzhmvM59FXsPkiemIbSjUcb+nw Ygot6WIX8TQbengeIhWmFEy6FsJSjdVZ2vYNai00v0xm+CdTMjtRD9LGS1r/HLpXGpTJ Y1WP1x5pDtMJxmCj6aHpQ2/lo88q47fDzM2T8= |
| MIME-Version | 1.0 |
| In-Reply-To | <2942f134-6c38-4a43-9322-b053ae61a14b@gc3g2000vbb.googlegroups.com> |
| References | <4e0d4d30$0$29990$c3e8da3$5496439d@news.astraweb.com> <mailman.546.1309543383.1164.python-list@python.org> <2942f134-6c38-4a43-9322-b053ae61a14b@gc3g2000vbb.googlegroups.com> |
| Date | Wed, 13 Jul 2011 14:20:42 +1000 |
| Subject | Re: Enhanced dir() function |
| From | Chris Angelico <rosuav@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.958.1310530845.1164.python-list@python.org> (permalink) |
| Lines | 20 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1310530845 news.xs4all.nl 23952 [2001:888:2000:d::a6]:53963 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:9363 |
Show key headers only | View raw
On Wed, Jul 13, 2011 at 7:46 AM, rantingrick <rantingrick@gmail.com> wrote:
>>>> [x for x in dir([]) if not x.startswith('_')]
> ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
> 'reverse', 'sort']
>
> Because we have plenty of room for args in this function...
>
>>>> dir(verbose=False)
> ['append', 'count', 'extend', 'index', 'insert', 'pop', 'remove',
> 'reverse', 'sort']
>
#define my_dir(o,verbose) verbose?dir(o):[x for x in dir(o) if not
x.startswith('_')]
And there you are, out of your difficulty at once. Granted, you now
have to run your code through cpp, but is that so big a problem?
ChrisA
(For the sarcasm-impaired: I am NOT advocating this.)
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Enhanced dir() function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-01 14:29 +1000
Re: Enhanced dir() function Tim Chase <python.list@tim.thechases.com> - 2011-07-01 12:20 -0500
Re: Enhanced dir() function Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2011-07-02 04:32 +1000
Re: Enhanced dir() function rantingrick <rantingrick@gmail.com> - 2011-07-12 14:46 -0700
Re: Enhanced dir() function Chris Angelico <rosuav@gmail.com> - 2011-07-13 14:20 +1000
Re: Enhanced dir() function Ethan Furman <ethan@stoneleaf.us> - 2011-07-01 11:40 -0700
Re: Enhanced dir() function Ethan Furman <ethan@stoneleaf.us> - 2011-07-12 14:19 -0700
Re: Enhanced dir() function rantingrick <rantingrick@gmail.com> - 2011-07-12 14:38 -0700
csiph-web