Re:Ask HN: Anyone using Python 3 in production?
by justin_vanw on Saturday June 26, 2010 @05:01PM
(#1464275)
Nobody is switching to Python 3. If you go first you get all of the pain and no advantages (plus switching later isn't very hard anwyay). I would import unicode_literals, division, and the print() function from __future__ and stick with 2.6.
[ Parent
| on HN ]
Re:Ask HN: Anyone using Python 3 in production?
by endtime on Saturday June 26, 2010 @05:29PM
(#1464318)
What are the benefits of print()?
Re:Ask HN: Anyone using Python 3 in production?
by samdk on Saturday June 26, 2010 @05:37PM
(#1464327)
It has optional arguments which make certain things a lot easier and make it much more consistent with the rest of the language.
sep is the separator between arguments, so you can do something like:
>> print('a','b','c',sep='')
abc
end is the value at the end of the line (useful, for example, if you want to print without a newline at the end).file lets you specify a file to print to, so for example you can do file=sys.stderr to print to stderr instead of stdout.
Re:Ask HN: Anyone using Python 3 in production?
by algorias on Saturday June 26, 2010 @10:38PM
(#1464746)
All that is just syntactic sugar.
print "comma prevents a newline from being printed",
print >> sys.stderr, "Any file object can be used"
The change to a function is purely for consistency, not functionality.
Re:Ask HN: Anyone using Python 3 in production?
by gometro33 on Saturday June 26, 2010 @08:00PM
(#1464544)
Being part of __future__, is print() slated for release in 2.7 or is it strictly a 3.x feature?
Re:Ask HN: Anyone using Python 3 in production?
by timf on Saturday June 26, 2010 @10:43PM
(#1464765)
In 2.7, print is still the print statement by default: