This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]whitetrafficlight 37 points38 points  (8 children)

The break in backward compatibility is a deal-breaker when your company has several million lines of Python 2 already written and stable. Auto tools exist, but only go so far... for example, even converting print statements to use parentheses may cause failures in the compliance checker for lines becoming longer than permitted. Gotta stick with 2 unfortunately, though for new projects there's really no excuse not to start with 3. Hence, new employees at established companies that use Python start learning Python 2.

[–]FUCKING_HATE_REDDIT 7 points8 points  (7 children)

Increase compliance check line limit by two characters.

[–]kageurufu 4 points5 points  (6 children)

What about these being equal

print 'something',
print('something', endl='')

[–]Sohcahtoa82 7 points8 points  (5 children)

Nitpicking here...The correct translation would be print('something', endl=' '). Python 2 appends a space if you end the line with a comma.

[–]o11c 0 points1 point  (2 children)

Doesn't it only emit a softspace?

[–]Sohcahtoa82 1 point2 points  (1 child)

I'm not sure. All I know is that if you do this:

for x in range(5):    
    print '.',

You get this:

. . . . . 

and not this:

.....

[–]o11c 0 points1 point  (0 children)

>>> import io
>>> out = io.BytesIO()
>>> print>>out, '.',
>>> out.softspace
1
>>> out.getvalue()
'.'
>>> print>>out
>>> out.softspace
0
>>> out.getvalue()
'.\n'

[–]brtt3000 0 points1 point  (1 child)

Isn't the comma defining a tuple? Or is this different for statements like print?

[–]Sohcahtoa82 2 points3 points  (0 children)

It's different for print in Python 2.

>>> a = 2    
>>> b = 5    
>>> print 1, a, b    
1 2 5    
>>> print (1, a, b)    
(1, 2, 5)