[issue20263] Function print definable as variables?

2014-01-14 Thread Ozy

New submission from Ozy:

Not sure if this is a bug. We're experiencing it in v3.3.2 and was discovered 
by accident.

It seems to be possible to define python functions (like print or input) as 
variables, as if they're not reserved. If you do that, the command 
functionality is lost until Python is reseted.

For example try this in IDLE:

 print = 10
 print
10
 print(print)
TypeError: int object is not callable
 print(10)
TypeError: int object is not callable

Here is a screenshot 

http://imgur.com/IpjELhp

We tested it, and this doesn't happen in v2.

Sorry if this has been reported previously.

Best regards.

--
messages: 208125
nosy: ozy
priority: normal
severity: normal
status: open
title: Function print definable as variables?
type: behavior
versions: Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20263
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20263] Function print definable as variables?

2014-01-14 Thread R. David Murray

R. David Murray added the comment:

Yes, that's the way Python works.  In Python3, print became a function and is 
no longer a keyword, so yes, it can be shadowed in the local namespace just 
like any other Python function.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20263
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20263] Function print definable as variables?

2014-01-14 Thread Ezio Melotti

Ezio Melotti added the comment:

FTR you can always get it back from builtins.print:

 print('test')
test
 print = 10
 print('test')
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'int' object is not callable
 import builtins
 print = builtins.print
 print('test')
test

--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20263
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20263] Function print definable as variables?

2014-01-14 Thread Ozy

Ozy added the comment:

Great, thanks. Didn't know that.

All the best.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20263
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com