1 | initial version |

```
sage: import sagess
0
sage: sagess.MyFunction(1,2)
1/2
```

The reason for the above behavior is that in the second call, the arguments 1 and 2 are Sage Integers, not Python ints: when run interactively, Sage preparses the input, turning all integers into the type `Integer`

. You could reproduce the effect of your original call of `MyFunction(1,2)`

in sagess.py by this:

```
sage: sagess.MyFunction(int(1), int(2))
```

On the other hand, to get 1/2, use Sage integers: rewrite your file as

```
#! /usr/bin/sage -python
# -*- coding: utf8 -*-
from sage.rings.all import Integer
def MyFunction(x,y):
print Integer(x)/Integer(y)
MyFunction(1,2)
```

This will give the right answer with integer arguments, but it will raise an error if you pass non-integer arguments.

2 | No.2 Revision |

```
sage: import sagess
0
sage: sagess.MyFunction(1,2)
1/2
```

The reason for the above behavior is that in the second call, the arguments 1 and 2 are Sage Integers, not Python ints: when run interactively, Sage preparses the input, turning all integers into the type `Integer`

. You could reproduce the effect of your original call of `MyFunction(1,2)`

in sagess.py by this:

```
sage: sagess.MyFunction(int(1), int(2))
```

On the other hand, to get 1/2, use Sage integers: rewrite your file as

```
#! /usr/bin/sage -python
# -*- coding: utf8 -*-
def MyFunction(x,y):
from sage.rings.all import Integer
```~~
def MyFunction(x,y):
~~ print Integer(x)/Integer(y)
MyFunction(1,2)

This will give the right answer with integer arguments, but it will raise an error if you pass non-integer arguments.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.