I just stumbled over some unexpected behaviour and thought I’d share it here.
Background: The standard division operator / behaves differently in python 2 and 3. While it performs an integer division in python 2 if both operands are integers, it always performs a true division in python 3.
Now RhinoPython is Python 2.7, so I thought it should behave the “old” way and did a quick test (on SR6):
import import_division print 1/3
Running run_division.py gave me the following output:
So apparently the directly run script uses “new division” while the imported script uses “old division”. This is unexpected to say the least. Tested it on two machines. So if you are getting strange results, have a look at your divisions…