[IPython-user] Disabling automatic parentheses feature?

Fernando Perez Fernando.Perez at colorado.edu
Thu Sep 9 13:59:45 CDT 2004


Francesc Alted wrote:
> Hi again,
> 
> Some user of this list has already answered my question. It's just a matter
> of reading the documentation and put "autocall = 0" on the ipythonrc file.

Yes, that does the trick permanently.  You can also set this on a particular 
profile, in case you want it on by default but off for certain classes of work 
(such as pytables), that's the whole idea behind profiles.  You can also 
disable it via a command line switch:

ipython -noautocall

so you could have an alias for this option.

And finally, you can toggle it at runtime at will:

In [10]: autocall
Automatic calling is: OFF

In [11]: autocall
Automatic calling is: ON

So you have a few options :)

> However, I still do think that providing the functionality described on my
> previous message would be nice for the reason that the objects can be
> personalized for the default behaviour with IPython and besides autocall
> feature would much more configurable that way.

Well, I'm not sure if I want to go in this direction, I'd rather keep ipython 
as decoupled as possible from third party code (in both directions). 
Problem-specific hooks sound appealing initially, but they tend to grow into 
an unwieldy hariball over time.  I prefer to have a few generic mechanisms 
with easy options for controlling them (as mentioned above, this particular 
one can be set on the ipythonrc base file, on a specific profile, at the 
command line, or even interactively).

Finally, ipython aliases 'p' for print, so you can see things quickly when 
they are callable and you just want to get their info:

In [12]: def foo():
    ....:     pass
    ....:

In [13]: foo
-------> foo()

In [14]: p foo
<function foo at 0x2a528f7c>

Hopefully this gives enough paths to accomplish what you want :)

Best regards,

f.

ps.  Here's the gnuplot config stuff I mentioned at scipy to get thicker 
linestyles for presentations:

#############################################################################
import IPython.GnuplotRuntime as GP

# Globals

# color switch
color_on = 1
color_mode = color_on and 'color' or 'monochrome'

# to reset gnuplot config to a known state in any function
gp_reset = """
reset
# font size of 28 is about the same size as latex fonts when plots
# are shrunk to 4 inches across. 24pts are a bit smaller, look better.
set term postscript enhanced %(color_mode)s blacktext eps "Times-Roman" 24 solid

# Don't forget to set the terminal back to x11 after PostScript options!
set term X11

# new linestyles (access as 'linestyle N' or 'ls N' in <with='lines ls N'>)
set style line 1 lt 1 lw 2 pt 1 ps 2
set style line 2 lt 3 lw 2 pt 2 ps 2 # note reversed colors for 2/3
set style line 3 lt 2 lw 2 pt 3 ps 2
set style line 4 lt 4 lw 2 pt 4 ps 2
set style line 5 lt 5 lw 2 pt 6 ps 2
set style line 6 lt 6 lw 2 pt 8 ps 2

set key box
"""  % locals()

# Activate config
reload(GP)  # so that each run clears gnuplot
gp = GP.gp # live gnuplot instance
gp(gp_reset)
#############################################################################


I hope this is useful.




More information about the IPython-user mailing list