Re: Enhanced dir() function

2011-07-12 Thread Ethan Furman
Ethan Furman wrote: Tim Chase wrote: If it came in as an effortless (i.e. O(1) where I do it once and never again; not an O(n) where n=the number of times I invoke Python) default replacement for dir(), I'd reach for it a lot more readily. I seem to recall there's some environment-var or

Re: Enhanced dir() function

2011-07-12 Thread rantingrick
On Jun 30, 11:29 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: The dir() function is designed for interactive use, inspecting objects for the names of attributes and methods. Here is an enhanced version that allows you to pass a glob to filter the names you see: meh, I

Re: Enhanced dir() function

2011-07-12 Thread rantingrick
On Jul 1, 12:20 pm, Tim Chase python.l...@tim.thechases.com wrote: If it came in as an effortless (i.e. O(1) where I do it once and never again; not an O(n) where n=the number of times I invoke Python) default replacement for dir(), I'd reach for it a lot more readily.  I seem to recall

Re: Enhanced dir() function

2011-07-12 Thread Chris Angelico
On Wed, Jul 13, 2011 at 7:46 AM, rantingrick rantingr...@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)

Re: Enhanced dir() function

2011-07-01 Thread Tim Chase
On 06/30/2011 11:29 PM, Steven D'Aprano wrote: The dir() function is designed for interactive use, inspecting objects for the names of attributes and methods. Here is an enhanced version that allows you to pass a glob to filter the names you see: Comments and improvements welcome. Having not

Re: Enhanced dir() function

2011-07-01 Thread Ethan Furman
Tim Chase wrote: If it came in as an effortless (i.e. O(1) where I do it once and never again; not an O(n) where n=the number of times I invoke Python) default replacement for dir(), I'd reach for it a lot more readily. I seem to recall there's some environment-var or magic file-name that

Re: Enhanced dir() function

2011-07-01 Thread Steven D'Aprano
Tim Chase wrote: On 06/30/2011 11:29 PM, Steven D'Aprano wrote: The dir() function is designed for interactive use, inspecting objects for the names of attributes and methods. Here is an enhanced version that allows you to pass a glob to filter the names you see: Comments and improvements

Enhanced dir() function

2011-06-30 Thread Steven D'Aprano
The dir() function is designed for interactive use, inspecting objects for the names of attributes and methods. Here is an enhanced version that allows you to pass a glob to filter the names you see: http://code.activestate.com/recipes/54-enhancing-dir-with-globs/ E.g. instead of this: