On Wednesday, August 21, 2013 11:30:14 PM UTC-7, Asad Akhlaq wrote:
>
> After a long struggle I am able to run my sage code in Eclipse. But I am 
> getting few errors when I run my code that runs without any error in sage 
> notebook.
>

Congratulations!
 

> For example   using "for" loop,   gives me error if I write "for  k in 
> [0..10]" , I need to change it to "for k in range(0,11)"   ... (I guess I 
> need to use Python syntax in Eclipse editor)
>

That's an indication that you're running python "with sage imported". The 
sage notebook and sage's IPython command line interface also run input 
strings through "preparse".  Example:

sage: preparse("[1..10]")
'(ellipsis_range(Integer(1),Ellipsis,Integer(10)))'
 

> I am using "multifactorial()" in my sage code. It runs good in sage 
> notebook, but now giving me error in Eclipse editor. 


> Error Message "AttributeError: 'int' object has no attribute 
> 'multifactorial' "
>

Indeed, the preparser also puts "Integer(...)" around any integer constant, 
to ensure that sage defaults to its own Integer type rather than python's 
"int".

Probably the most easily recognized difference is:

sage: 2^3 #exponentiation
8

versus python's

 >>> 2^3 #exclusive or
1

I use " import sys   and  from sage.all import * "  at the start of my code.
>
 
This means that the environment you have created is very similar to the one 
in which you have to work when you're writing sage library code (which 
doesn't get preparsed either), which is really rather appropriate given 
that eclipse is a software development environment. 
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to