Comment on PEP-0238

Thomas Wouters thomas at xs4all.net
Mon Jul 9 01:52:24 CEST 2001


On Sun, Jul 08, 2001 at 10:45:12PM +0000, Bengt Richter wrote:

> Why not parameterize the concept with a single block-scope-introducing
> keyword, e.g., 'semantics' or 'special' e.g., rewriting from above:

> semantics PRECISION, 0: # everything behaves as it does now
>     print 2 / 7    # -> 0, ie to precision 0 decimal places
>     print 2/7.0   # -> 0.285714285714

> semantics PRECISION 1:   # all calculations yield 1 decimal point 
>     print 2 / 7    # -> 0.2, ie to precision 1 decimal places

Doesn't fix the problems. What about this:

semantics PRECISION, 0:
    x = 2/7

semantics PRECISION, 100:
    print x


-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list