Re: Python has Traps; Does Euphoria have Programming Traps?
- Posted by jimcbrown (admin) Aug 13, 2013
- 2341 views
SDPringle said...
I would like to add use of a leading 0 for octal notation as a trap. Maybe you have several values in a case statement with some three digit numbers and a couple of two digit numbers or a constant list declaration then you might be tempted to put a zero expressing numbers like 77 as 077. In Python 077 is not 77. Division is truncated if you start with integers: 1/2 = 0
>>> 077 63 >>> 1/2 0 >>>
In EUPHORIA
? 077 # 77 ? 1/2 # 0.5
I remember how I got burned by this while trying to port code to Euphoria over a decade ago.