Comments (9)
I can take a look this weekend 👍
from cpython.
Hmm...... But I'm trying to call a function outside the class. Why should it "mangled"? Shouldn't it happen only I am trying to get a class method?
In an ideal world, yes. But how do we determine that some lookups inside the class body are class-specific? These slow down performance due to additional lookups and just slightly increase user experience. To summarize, just don't name your functions with double leading underscores. :)
from cpython.
Yeah they normally go in tandem. I will let you know what we decide here once I have some time to play with this
from cpython.
This is intended behaviour. Explanation: https://docs.python.org/3.12/faq/programming.html#i-try-to-use-spam-and-i-get-an-error-about-someclassname-spam.
from cpython.
from cpython.
from cpython.
That's perhaps the best solution:) But, could the interpreter tell the user the problem when it show the error? I don't think showing error needs to be as fast as possible :)
Yes, that's sounds reasonable for me.
from cpython.
cc @pablogsal Do you think it's worth improving the error message for "NameError" in such cases?
from cpython.
I want to extend this issue.
This code:
def __a():
print("A")
class A:
def b(self):
self.__a()
a = A()
a.b()
throws another error:
AttributeError: 'A' object has no attribute '_A__a'
If NameError
is planning to be improved, this should be also fixed
from cpython.
Related Issues (20)
- logging.config: configuring root through dictConfig won't update already existing loggers HOT 1
- AttributeError: 'datetime.datetime' object has no attribute 'times' HOT 1
- [CI/CD] allow to skip tests that are know to lack a C (or Python) implementation. HOT 5
- a biit better example in pathlib docs - maybe include example path that involves file in a folder(s)? HOT 1
- Security branches: Consider fixing the documentation or adding a notice banner HOT 1
- New REPL omits local variables when running ./python -i script.py HOT 2
- importlib.metadata test fixtures should prefer test.support fixtures
- Lacking description of how to correctly implement indexing syntax support.
- Rewrite asyncio subprocesses without child watchers
- Unpickling Exceptions with keyword arguments in multiprocessing throws an error HOT 12
- Reference leak in `_contextvars.Context.run()`
- Allow one to use build.bat to skip building test project files entirely. HOT 4
- CANT FIND THE FUCKING DOWNLOAD BUTTON HOT 2
- Typo in the documentation of the `cmd` parameter of `ftplib.FTP.retrbinary()` HOT 1
- ios buildbot failure: `enclose 'sqlite3_create_window_function' in a __builtin_available check to silence this warning` HOT 1
- generator frame type should not be PyObject*[]
- `subprocess.run` docs should recommend copying `os.environ` on Windows HOT 3
- `faulthandler` itself crashes in free-threading build (in `_Py_DumpExtensionModules`)
- Some Runtime Finalization Constraints Are Not Enforced Nor Documented
- asyncio REPL fails to run with TERM=dumb or PYTHON_BASIC_REPL in 3.13.0b2 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpython.