Division oddity

Michael Hudson mwh at python.net
Wed Jan 14 12:30:26 CET 2004


Peter Hansen <peter at engcorp.com> writes:

> 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?

Yes.

> 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?

Oh, probably...

Cheers,
mwh

-- 
  I'll write on my monitor fifty times 'I must not post self-indulgent
  wibble nobody is interested in to ucam.chat just because I'm bored
  and I can't find the bug I'm supposed to fix'.
                                            -- Steve Kitson, ucam.chat



More information about the Python-list mailing list