4 ms·
>> There was really no compelling reason to do it > the print was more like a little fuck you to maintenance devs everywhere > If they wanted print-as-functio
by guitarbill 10y ago
>> There was really no compelling reason to do it
> the print was more like a little fuck you to maintenance devs everywhere
> If they wanted print-as-function, fine, but they didn't have to eliminate the print statement at the same time.
Complete and utter hyperbole. You could read PEP-3105 [0] and easily see it isn't true. In addition to this, quoting from both the PEP and the docs [0][1]:
> "Luckily, as it is a statement in Python 2, print can be detected and replaced reliably and non-ambiguously by an automated tool, so there should be no major porting problems (provided someone writes the mentioned tool)."
> "When using the 2to3 source-to-source conversion tool, all print statements are automatically converted to print() function calls, so this is mostly a non-issue for larger projects."
Enough with the bullshit.
[0] https://www.python.org/dev/peps/pep-3105/ https://www.python.org/dev/peps/pep-3105/
[1] https://docs.python.org/3/whatsnew/3.0.html https://docs.python.org/3/whatsnew/3.0.html
- hartator 10y agoAt the end of day, if enough people beleive print requiring brakets is an issue, it's becoming an issue. I beleive it and few other people beleive it in this thread. There is no added benefits to have done that. They are just not listening. Now, Pythons 2/3 are sufferin despite being one of best language out there.
- guitarbill 10y ago> There is no added benefits to have done that. For god's sake, it is subtle, but not that hard to understand. There are added benefits. For one thing, consistency. Why is `sys.stdin.write()` a function but `print` isn't? What happens if you want to replace `print` with your own function, e.g. for logging? With a print function, you can just reassign that function, with a statement, you can't. What's the effect of this switch on the bytecode/parsing code? All the arguments against it seem to come down to "I don't like it". > being one of best language out there. Why is Python one of the best languages out there? Ease of use through consistency. Surely that's just an argument for `print()`. Python3 allowed the devs to fix some of the mistakes or sins of the past, similarly `input`/`raw_input`. In the short term, it's maybe a bit of hassle. In the long run, not at all. 2to3 handles this mostly, but you can use `from __future__ import print_function` to test it in Python2. Nobody is refusing to switch to Python3 because of `print` alone.
- hartator 10y agoNo one is against making print a function, we are just disappointed against the mandatory bracket thing. It's exactly what's wrong, you are not understanding because you don't want to listen. I agree with all the arguments you are presenting, but why can't you see why having to add - mandatory - brackets can be annoying? In addition, the hack is already there: Python 3.5.2 (default, Dec 2015, 13:05:11) [GCC 4.8.2] on linux print "hello" Traceback (most recent call last): File "python", line 1 print "hello" ^ SyntaxError: Missing parentheses in call to 'print' Why not just calling print? We can do it right now and it's requiring no changes to the 3.x parser. Finally, the print stuff was one of the main reasons I pick Ruby over Python for my startup 5 years ago. I may be alone but I don't think so. And I think I make the right decision. Look at the some of the latest benchmarks Ruby vs Python. Python is now lagging strongly behind when it was ahead 5 years ago with 2.7. The 3.x branch keeps making weird decisions.
- IanCal 10y agoSo make it a function, but the only function with optional parentheses? And only in some cases?
- Sanddancer 10y agoThings like the parentheses in print was why the 2.7 branch was created -- allow the old to exist and make available some of the new features. Probably the biggest mistake there was not to make deprecation warnings on by default, to accentuate that it was a transitionary release. Then again, it's the same problem PHP has, with not wanting to warn that the old way of doing things is going away for various reasons.
- guitarbill 10y ago> we are just disappointed against the mandatory bracket thing. It's exactly what's wrong, you are not understanding because you don't want to listen. It's not hard. This isn't some arbitrary bracket hate or love, it's how the language syntax works at it's core: statements (e.g. if, el, in) never have brackets, function invocation always has. Simple! So what am I not understanding? That you are proposing some other syntax, e.g. function invocation without brackets? That you don't like breaking changes? That you'd keep everything as it was for sake of habit? Python 3 breaks Python 2 in many ways, but okay. Any other coherent arguments why `print` should remain a statement? > Finally, the print stuff was one of the main reasons I pick Ruby over Python for my startup 5 years ago There are enough things to not like about Python 3. But do not get me started on Ruby. A language that constantly breaks stuff between minor version numbers (1.8 -> 1.9, 1.9 -> 2.0, etc)? Way to undermine your own argument. Edit: To append this infamous article about a Ruby migration 1.8.7 to 1.9.3 (http://www.darkridge.com/~jpr5/2012/10/03/ruby-1.8.7-1.9.3-migration/ http://www.darkridge.com/~jpr5/2012/10/03/ruby-1.8.7-1.9.3-m...), lest I be accused of Ruby bashing. Of course, the original article we're discussing mentions Ruby in the same breath with Python 3. Oh, the irony of trying to put down Python 3 by citing Ruby.
- rspeer 10y agoAs much as I want Python 3 to replace Python 2, you can't recommend 2to3 while saying "Enough with the bullshit". 2to3 is abandonware that never worked. Now you can use python-future instead, a third-party solution, but the 2to3 part of the PEP was a false promise that gave ammo to Python 2 fans.
- zodiac 10y ago> the 2to3 part of the PEP was a false promise that gave ammo to Python 2 fans The PEP (3105) doesn't actually mention 2to3 anywhere, it just says that the fact that print is a statement (ie handled explicitly in the language syntax) means it is easy to write a tool to do the conversion automatically. Which is a perfectly valid point, even if 2to3 fails to do that for some reason.