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


Groups > comp.lang.python > #9347

Re: Enhanced dir() function

Date 2011-07-12 14:19 -0700
From Ethan Furman <ethan@stoneleaf.us>
Subject Re: Enhanced dir() function
References <4e0d4d30$0$29990$c3e8da3$5496439d@news.astraweb.com> <4E0E01F9.80803@tim.thechases.com> <4E0E1491.8070007@stoneleaf.us>
Newsgroups comp.lang.python
Message-ID <mailman.954.1310504678.1164.python-list@python.org> (permalink)

Show all headers | View raw


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 magic file-name that 
>> gets sourced on every startup.
> 
> interact.py
> 8<-----------------------------------------------
> import os, sys
> sys.ps1 = '--> '
> 
> from cookbook.utils import dir  # or whereever you keep your copy
> sys.modules['__builtin__'].dir = dir
> 8<-----------------------------------------------


Imagine my amusement when I went to change an environment variable today 
and found:

PYTHONSTARTUP=c:\python25\interact.py

~Ethan~

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


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