Division oddity

Peter Hansen peter at engcorp.com
Tue Jan 13 14:21:16 EST 2004


Michael Hudson wrote:
> 
> Peter Hansen <peter at engcorp.com> writes:
> 
> > Tim Rowe wrote:
> > >
> > > Well, the documentation for "input()" says "Equivalent to
> > > eval(raw_input(/prompt/))". Perhaps it should say "/Usually/
> > > equivalent...."
> >
> > I remember reading that too, and just assumed that at this point
> > it was in fact *implemented* that way, as a simple alias.  Maybe
> > it should be...
> 
> http://www.python.org/sf/876178
> 
> Ideas on how to write a testcase welcome.

Are there any test cases which verify behaviour both in the presence
and absence of certain "from __future__ import" statements?

My first thought would have been simply to write two test files,
one of which imports from __future__ and the other which does not,
and check that in both cases input(x) == eval(raw_input(x)).  

Or is the issue how to test when the input comes from stdin?  In
that case, doesn't faking sys.stdin work as usual?

-Peter



More information about the Python-list mailing list