question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Investigate how we can warn of/prevent redefinition of built-ins

See original GitHub issue

Building off of https://github.com/pytest-dev/pytest/pull/7428 we should investigate if there’s an elegant way we can detect and prevent redefinition of built-ins. pylint supports this under W0622, but we do not use pylint ( rationale as to why can be found here )

The high level steps of what we’d want to accomplish would then be:

  • determine if we want to prevent redefinition of built ins, or stop short of blocking with some sort of warning, log message, etc. ( or if we even want to block this at all )
  • determine which tool we could use to accomplish this
  • perform a one time sweep to remove any overridden built ins
  • hook it into our CI pipeline

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:29 (29 by maintainers)

github_iconTop GitHub Comments

1reaction
gnikonorovcommented, Jul 29, 2020

No worries @nicoddemus! Glad we discussed this and came to a consensus

1reaction
The-Compilercommented, Jul 8, 2020

Disclaimer: I love linters. I run pylint, flake8 + plugins, mypy and others (like vulture) myself.

From a quick look at #7449, the reason for most (or at least some) of the “noqa” comments is that we have such names exposed via our API. We definitely should not use built-in Python names as argument names, because it e.g. leads to confusing syntax highlighting in editors:

image

I guess the choice is less clear for methods. I suppose I’m ±0 about disabling A003 (methods/class attributes shadowing built ins) as they are clearly namespaced and it’s something Python’s API is doing as well (e.g. logging.LogFilter.filter). I suppose that’d eliminate the need for most noqa comments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Suppresing "Redefining built-in ..." pylint warning
Since pylint 1.6 there is a new option --redefining-builtins-modules . Adding builtins to its default value six.moves,future.builtins fixes ...
Read more >
- VIEWS OF THE NIST NOBEL LAUREATES ON SCIENCE ...
The NIST's research programs are carried out through eight laboratories: Building ... The request for NIST will increase the ability of U.S. researchers...
Read more >
Redefinition of variables | Codecademy
I'm looking at this specific exercise, but I had it happen before as well. My code looks like this: var nameString = function(name)...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found