Consider this python program:

----------------
def foo():
  return 'foo'

print foo()

def mumble():
  print 'mumble',foo()

mumble()
----------------

If put this in a file foo.py and type `python foo.py'  it prints

foo
mumble foo

Same thing if I type 'sage foo.py'.  Same thing if I put it in a cell
of a sage notebook and evaluate with sage.
But if switch the evaluation option for the notebook from sage to
python I get an error:

foo
mumble
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/doyle/.sage/sage_notebook/worksheets/admin/2/code/
68.py", line 12, in <module>
    print mumble()''', '/home/doyle/.sage/sage_notebook/worksheets/
admin/2/cells/5')
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/server/
support.py", line 258, in syseval
    return system.eval(cmd, locals = sage_globals)
  File "/usr/local/sage/local/lib/python2.5/site-packages/sage/misc/
python.py", line 21, in eval
    eval(z, globals, locals)
  File "/usr/local/sage-2.8.15-ubuntu32bit-i686-Linux/data/extcode/
sage/", line 1, in <module>

  File "/usr/local/sage-2.8.15-ubuntu32bit-i686-Linux/data/extcode/
sage/", line 7, in mumble

NameError: global name 'foo' is not defined

I get the same error if I change the notebook evaluation option back
to sage, put %python at the beginning of the cell, and evaluate.

Is this a bug or a feature?

Cheers,

Peter
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to