Asad,

I wonder if an import from __future__ happened, perhaps in the version of
collections you used. Later versions of 2.x allow optional use of the 3.x
style of print.

When you redefine print, the old statement style is hidden or worse.

-----Original Message-----
From: Tutor <[email protected]> On Behalf Of
Asad
Sent: Tuesday, December 11, 2018 10:38 AM
To: [email protected]
Subject: [Tutor] Increase performance of the script

Hi All,

          I used your solution , however found a strange issue with deque :

I am using python 2.6.6:

>>> import collections
>>> d = collections.deque('abcdefg')
>>> print 'Deque:', d
  File "<stdin>", line 1
    print 'Deque:', d
                 ^
SyntaxError: invalid syntax
>>> print ('Deque:', d)
Deque: deque(['a', 'b', 'c', 'd', 'e', 'f', 'g'])
>>> print d
  File "<stdin>", line 1
    print d
          ^
SyntaxError: invalid syntax
>>> print (d)
deque(['a', 'b', 'c', 'd', 'e', 'f', 'g'])

In python 2.6 print statement work as print "Solution"

however after import collection I have to use print with print("Solution")
is this a known issue ?

Please let me know .

Thanks,


_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to