-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configuration should not use attributes starting with __
to not run into name mangling options.
#174
Comments
Strange. Somehow the name gets mangled. I'll look into it later... import sys
import clingo
def test(cfg):
print (cfg.__desc_models)
class Application:
def main(self, prg, files):
#print(prg.configuration.solve.__desc_models)
print (getattr(prg.configuration.solve, "__desc_models"))
print (test(prg.configuration.solve))
sys.exit(int(clingo.clingo_main(Application(), sys.argv[1:]))) |
Double underscore is always mangled to make the symbol private and unaccessible from the "outside", e.g., in derived classes. As far as I know, calling such methods is only possible from a method in the same class, not from outside (and calling from a derived class counts as outside). |
Yes, you are right. I was thinking the name mangling is applied based on the type of the target object but this is not the case. So there is no bug. It was just a bad idea to prefix the |
For reference, the symbol is not unaccessible. You may access it using |
Thank you! |
There is now a description method. Have a look at the example along with the commit. |
__
to not run into name mangling options.
thx |
I found a mismatch in the Configuration interface when using python.
If this is due to my lacking python skills I'm very sorry.
The following example is given in the API documentation to read the description of the configuration interface:
When using the clingo_main method using an Application
I do get the following error:
The text was updated successfully, but these errors were encountered: