Language change and code breaks
David Bolen
db3l at fitlinxx.com
Wed Jul 11 20:31:37 EDT 2001
"Fredrik Lundh" <fredrik at pythonware.com> writes:
> David Bolen wrote:
> >
> > > And a//b definitely beats (a+0.)/b, which does the trick, but is not
> > > at all evident.
> >
> > Well, I'd probably suggest using "float(a)/b" instead which at least
> > makes it a little easier to see what's going on :-)
>
> except that it doesn't do the right thing if a is a complex
> number.
Hmm, good point - I hadn't thought of that.
Of course, if a was complex then we wouldn't be worried about a/b
truncating anything either. But definitely something to keep in mind
if working on code that might receive either complex or integer
parameters.
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list