4 ms·
I want to like Python 3 but the print statement change really kills it for me. Years later it's still frustrating on the occasions I write a python script. If I
by jimmaswell 11y ago
I want to like Python 3 but the print statement change really kills it for me. Years later it's still frustrating on the occasions I write a python script. If I ran a project like one of those, I might not use Python just for this reason.
- njharman 11y agoReally?, Really! Because every other output method was a function the statement is annoying as all hell. Swapping between print and fh.write() log.error(), stringio.write(), sys.stderr.write(), mycustom_thing_that_suppresses_print_when_quiet_arg_supplied() in python 2.x is annoying as all fuck and simple 'ct(' with python 3.x
- scrollaway 11y agoLook up 'q' on pypi. Thank me later. :)
- njharman 11y agoI resolved to use print debugging less and pdb more. This makes that even harder, thanks a lot. :)
- scrollaway 11y agoq.d() ;)
- orf 11y agoI really don't see how the print statement can be that bigger deal. After a week at most you're used to it and `print(x)` is valid syntax on Python 2 (so don't worry about what way to write it).
- eugenekolo2 11y agoI write Python 2 code, and just always use `print("...")` in both. It makes a lot more sense, matches other languages syntax, and is compatible in both. I honestly don't see it in any way worse than `print "...."`.
- chucksmash 11y agoAgreed. Still on Python 2.7 but at some point last year I just decided I'd always: from __future__ import print_function When I needed to print and it's just habit now..
- deleted 11y ago[deleted]
- kevin_thibedeau 11y agoBeen using most of __future__ for years to make the transition seamless for me. This is what Py 2.x devs should be doing now. It's not like the path forward hasn't been paved for us for many years.
- theptip 11y agoThis is the most trivial of all the changes introduced in Python3. If you'd said something about string encodings, you might have got sympathy from someone...
- kbutler 11y agoI empathize. Makes me want a parenthesis-optional language, though that has its own headaches. I find switching to log() as an output function helps psychologically - it's shorter to type than print, and it's something I'm more likely to keep in production.