4 ms·
"11. There should be one-- and preferably only one --obvious way to do it." from the Zen of Python. Somebody intentionally misread it as, "There should be only
by pishpash 9y ago
"11. There should be one-- and preferably only one --obvious way to do it." from the Zen of Python. Somebody intentionally misread it as, "There should be only one way to do it." They obviously made a grave mistake. Same with many 2->3 changes.
- kevin_thibedeau 9y agoThe old way was foolishly inconsistent with the rest of the language. It only serves as an small expedient in the REPL.
- catdog 9y agoAlso from the Zen of Python: "Special cases aren't special enough to break the rules", the old print statement contains a lot of special syntax not found anywhere else in the language. Also "Readability counts", it's really obvious what print("foo", file=sys.stderr, end="") does instead of deciphering a construct like print >>sys.stderr, "foo", . Moreover you can pass a print function around, perform partial application, etc., a statement does not give you that.
- pishpash 9y agoYou prove nothing about why the two cannot co-exist in a non-regressive way. 'print' as a function already exists in Python 2, providing all the benefits you describe.
- pishpash 9y agoI stand very much corrected on the issue of 'print' and retract the above -- it only looks like a function syntactically in special (albeit, the most common) cases; PEP 3105 makes good points on how Python's parsing of whitespaces and parens renders a non-regressive parser out of reach. RTFM, I guess.