[IPython-user] Changing context in iPython CLI

Fernando Perez Fernando.Perez at colorado.edu
Fri Oct 7 01:42:19 CDT 2005


Ville Vainio wrote:
>>Define a function to return what you want:
>>
>>def lower():return x.lower()
> 
> 
> It should also be pretty doable to implement a magic/function to copy
> all names from an object to functions in ipython global namespace, so
> that you could do
> 
> # myobj.stuff()
> 
> # %makeglobals myobj
> 
> # stuff()   # calls "curried" version with self as first arg

Yup, that's another approach that can also work (I think I prefer the %prepend 
one, simply because I'm picky about namespace clashes, but that's really a 
personal preference).

Cheers,

f




More information about the IPython-user mailing list