classification
Title: Do not use the name of the built-in function as a variable.
Type: enhancement Stage: resolved
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, ys19991
Priority: normal Keywords: patch

Created on 2020-07-10 06:55 by ys19991, last changed 2020-07-10 07:43 by serhiy.storchaka. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 21427 closed ys19991, 2020-07-10 07:00
PR 21428 closed ys19991, 2020-07-10 07:08
Messages (2)
msg373442 - (view) Author: Wansoo Kim (ys19991) * Date: 2020-07-10 06:55
Using the name of the built-in function as a variable can cause unexpected problems.

```
# example

type = 'Hello'

...

type('Happy')

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

```

You can go back without any problems right now, but you may have problems later when others make corrections.

This code can be returned without any problems right now, but it may cause problems later when others make a change.

In the Lib/xml/etree function/_default, assign a value for the type.

```
...

type = self._doctype[1]
if type == "PUBLIC" and n == 4:
    name, type, pubis, system = self._doctype

...
```
msg373448 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2020-07-10 07:43
We usually do not accept pure cosmetic changes.
History
Date User Action Args
2020-07-10 07:43:18serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg373448

resolution: not a bug
stage: patch review -> resolved
2020-07-10 07:08:22ys19991setpull_requests: + pull_request20575
2020-07-10 07:00:48ys19991setkeywords: + patch
stage: patch review
pull_requests: + pull_request20574
2020-07-10 06:55:52ys19991create