On Thu, May 29, 2014 at 5:22 PM, Oleg Eterevsky <[email protected]> wrote:
> a = int(f.read_line())
> let a: int = from_str(f.read_line().unwrap().as_slice().trim()).unwrap();

It depends what you mean by 'required.'

For a production project, I think it would be a good idea to have
separate error messages for EOF and invalid numbers, which would not
be more verbose in Rust than C++ or Python.

For the type of short personal-use-only script I write a lot in
Python, where it isn't worth it to deal with error conditions, I agree
that is very noisy.  I personally think the trait should be
implemented so as_slice() isn't required, and considering the vast
amount of .unwrap() even in standard library code, I think it might do
well to have an operator for it.  Again, I am not a contributor so
it's just my two cents.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to