Re:Berkeley AI Materials
by JoshTriplett on Tuesday January 19, 2016 @11:48AM
(#10931899)
> Python 2.7 is also better for learning with the simple print syntax.
For the simple case, I don't consider "print(foo)" more complex than "print foo"; if anything, it avoids introducing additional syntax, and instead just provides another built-in function. And in more complex cases, such as printing to a file object, the syntax seems far more straightforward: "print(foo, file=f)" versus "print >>f, foo". Beyond that, the print function can do some things the print statement simply can't, such as print without a trailing space or newline.
For the simple case, I don't consider "print(foo)" more complex than "print foo"; if anything, it avoids introducing additional syntax, and instead just provides another built-in function. And in more complex cases, such as printing to a file object, the syntax seems far more straightforward: "print(foo, file=f)" versus "print >>f, foo". Beyond that, the print function can do some things the print statement simply can't, such as print without a trailing space or newline.