This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: print()
Type: behavior Stage:
Components: Versions: Python 3.4
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: gazza7364, georg.brandl
Priority: normal Keywords:

Created on 2014-10-23 19:03 by gazza7364, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg229890 - (view) Author: Garry Smith (gazza7364) Date: 2014-10-23 19:03
Problem with print()
I did the following by accident while in the python console, print = 10, which it let me do, to horror.after that I could not use the print() command without getting the following error:-

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable

This is what I type in the console.

print = 33
a = 34
print(a)

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not callable.

The only way to get the print command back was close and reopen the console.
msg229892 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2014-10-23 19:06
This is as expected; the new global name "print" overrides the builtin name "print".

(What you could also have done to remove your binding is "del print", which removes the global binding.)
History
Date User Action Args
2022-04-11 14:58:09adminsetgithub: 66902
2014-10-23 19:06:40georg.brandlsetstatus: open -> closed

nosy: + georg.brandl
messages: + msg229892

resolution: not a bug
2014-10-23 19:03:16gazza7364create