4 ms·
from __future__ import print_function on python2 solves the print function incompat.
by guipsp 12y ago
from __future__ import print_function on python2 solves the print function incompat.
- raverbashing 12y agoExactly this Why is changing 'print stuff' to 'print (stuff)' such a big deal? I think 2To3 solves a lot of print cases https://docs.python.org/2/library/2to3.html https://docs.python.org/2/library/2to3.html
- bufordsharkley 12y agoThe print function is clearly a better, more precise way to handle it, to be sure... But the print statement was one prominent, attractive way that Python was essentially pseudocode-- its removal seems an improvement from a pedantic sense, but one that seems to run contrary to convenience and (perhaps) the expectations of a beginner.
- TimSAstro 12y agoI disagree about this being worse for beginners - if we're teaching a new programmer about functions, surely a basic print function is a great introduction? Whereas before it was a one-off special case.
- panglott 12y agoAs a beginner, I ~hated~ the print statement. The print function had analogous syntax to all other functions, whereas the print statement always seemed to use some kludgy tricks.
- plesner 12y agoTo what end though? It's a small thing sure but it's busywork. Why am I being asked to do busywork?
- raverbashing 12y agoYeah, I don't like the busywork that Pep8 makes me do it, and it's a lot, and some of it is stupid, but it has to be done You certainly don't have to do it if you don't want Python 3 and 2to3 makes it a lot easier
- coldtea 12y ago>Yeah, I don't like the busywork that Pep8 makes me do it, and it's a lot, and some of it is stupid, but it has to be done Actually no, it hasn't. PEP8 is just a formatting standard, your code will work with your own standard too.
- raverbashing 12y agoTrue, I meant this https://pypi.python.org/pypi/pep8 https://pypi.python.org/pypi/pep8
- alexchamberlain 12y agoGuido doesn't like that tool; they're guidelines, not rules.
- raverbashing 12y ago> Guido doesn't like that tool; they're guidelines, not rules. Yes, a lot of people need to get that memo I don't like it as well, but it keeps a group of developers in check. And it can be configured, so there's that as well Too bad autopep8 produces bad results out of the box