4 ms·
print as a function made it into Python 2.6 (using future imports). It's probably one of the more purely stylistic choices in 3.X. The function style is probabl
by maxerickson 13y ago
print as a function made it into Python 2.6 (using future imports). It's probably one of the more purely stylistic choices in 3.X. The function style is probably better for pretty much all shipping code (as opposed to someone typing at an interpreter).
The Unicode switchover is where all the pain is, and it isn't particularly clear that there is a good way to do such a thing.
- ma2rten 13y agoI for one like the 2.x style print function. I see why it would be a bad idea to have a separate syntax for print from a purist point of view. But least for smallish scripts which print a lot it give you a better overview because the print line look different than other lines. Sometimes prints can almost be like comments.
- dragonwriter 13y ago> I for one like the 2.x style print function. 2.x didn't have a print function, unless you mean the one from 3 available with a from __future__ import.
- montecarl 13y agoIn case the grandparent doesn't realize, 2.x has a print statement not function.
- ma2rten 13y agoI meant function as in functionality. This is really pointless nitpicking.
- yukichan 13y agoKnowing the difference between functions and statements is not pointless nitpicking. Not in the least.
- ghshephard 13y agoNormally I would agree with you - but one of the epic changes between 2.x and 3.x python, was the change of print from a statement to a function - so, in this case, it's not so much nitpicking as pointing out one of the major changes between the two streams of python.
- anaphor 13y agoActually it's a procedure because it has a side-effect.
- dragonwriter 13y agoIn python, they are called "functions" whether or not they have side effects. (And, actually, in most programming languages I've seen that have different constructs called "function" and "procedure", the difference is that functions have a return value and procedures don't -- usually, both can have side effects.)
- anaphor 13y agoHave you ever used a functional programming language?