[IPython-user] pysh variable substituion and scope

Krishna Mohan Gundu gkmohan at gmail.com
Sat Jun 3 18:10:24 CDT 2006


Hello All,

It looks like during variable substituion the scope is limited to the
global scope rather than the scope of the calling function. Can the
current behavior be modified to include the proper scope? In the
following example

===
gvar = 0

def pysh_test(lvar):
   echo "$gvar $lvar"

pysh_test(0)
===

gvar is substitued but lvar cannot be found in the scope



`ipython -ipthondir` seems to be broken in SVN. Even with this option
it looks for "~/.ipython/ipy_user_conf.py"

===
[krishna at master ipython]$ ipython.py -ipythondir ~/.ipython-svn
WARNING: Could not import user config!
 ('/home/krishna/.ipython/ipy_user_conf.py' does not exist? Please run
'%upgrade')

Python 2.4.3 (#1, Apr  8 2006, 19:10:42)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.2 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
%magic  -> Information about IPython's 'magic' % functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
===

Finally, I would like to ask why %echo differs in behavior from the
shell echo command. It escapes '#' when printed and I dont remember
but I noticed it produces some extra spaces with certain prints.

===
krishna at master[ipython]|1> echo "# hash is escaped?"
\# hash is escaped?
===

cheers,
Krishna.




More information about the IPython-user mailing list