Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Beware of divisions!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Beware of divisions!
Authored by: fabrizio on Feb 03, '05 02:22:08PM

Python as a default gives you the integer part of a division, i.e. if you type 5/2, it gives 2 as result. You could type 5.0/2 and it would give the floating point result, but it's quite annoying. You could resolve defining a shell alias so that python is launched with the -Qnew switch. In tcsh you would add this alias to your "~/.tcshrc" file:

alias python 'python -Qnew'



[ Reply to This | # ]