[Python-Dev] Re: [Python-checkins] python/dist/src/Objects stringobject.c,2.171,2.172

Neal Norwitz neal@metaslash.com
Sun, 28 Jul 2002 22:31:39 -0400


Greg Ewing wrote:
> 
> Neal Norwitz <neal@metaslash.com>:
> 
> > The intent was to convert an int/long to a double in the case of
> > '%g' et al and from a double to an int in the case of '%d'.
> 
> Are you sure the latter part of that is a good idea?  As a general
> principle, I don't think float->int conversions should be done
> automatically. What is the Python philosophy on that?

This is consistent with versions back to 1.5.2:

	Python 1.5.2 (#1, Jul  5 2001, 03:02:19)  [GCC 2.96 20000731 
			(Red Hat Linux 7.1 2 on linux-i386
	Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
	>>> '%d' % 1.8
	'1'

Neal