[docs] Issue with python function names

david becker ardavidbecker at gmail.com
Sat Feb 6 00:49:10 EST 2016


And of course the same thing happens if we use them for variable names as
well.

>>> type = 2
>>> type(4)
Traceback (most recent call last):
  File "<pyshell#74>", line 1, in <module>
    type(4)
TypeError: 'int' object is not callable


I feel there is no point in allowing them as they cannot be used. Users are
restricted to use the 32 keywords but we can't force them to remember all
built in function names and not to use them as variable or function names.
:)

Thanks,
David Becker

On Sat, Feb 6, 2016 at 11:11 AM, david becker <ardavidbecker at gmail.com>
wrote:

> Hi,
>
> I have a query in using function names. Python allows users to write their
> own functions with built-in function names.
>
> Example:
> def print():
>       return "strange"
>
> print() -- Returns strange
> ++++++++++++++++++++++++++++
>
> But the built in "print" function doesn't work any more till i restart the
> shell.
> I personally feel users should not be allowed to use built in function
> names. Is there any special reason why python allows them?
>
> Thanks,
> David Becker
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20160206/68803518/attachment-0001.html>


More information about the docs mailing list