(2016-09-24, 21:10)Milhouse Wrote: (2016-09-24, 14:39)Roman_V_M Wrote: What you say maybe true for some other languages like C++ or C# where assert is indeed a purely a debugging tool, but not for Python.
Not a debugging tool in Python?
So, not a Pythonista either? *sighs* I guess, it will be hard...
Python has full object introspection at runtime and special hooks for attaching tracing functions to the running code, so it does not need special "debug" mode or debug symbols, like statically compiled languages.
Quote:That's exactly what it sounds like... from the Python docs:
Quote:In the current implementation, the built-in variable __debug__ is True under normal circumstances, False when optimization is requested (command line option -O). The current code generator emits no code for an assert statement when optimization is requested at compile time.
Unoptimized code is for development/debugging, optimized code for release (when you are done debugging).
Sorry, but have I been writing in this topic in Ukrainian? It looks like it, so a short translation for you: in current CPython implementations, both Python 2 and Python 3, optimized mode does not do any real optimization and is used basically never. Kodi is the only example known to me. Moreover, in many Python libraries, including parts of the Standard Library,
assert statement is used to check for abnormal conditions at runtime. Like it or not, but it's a fact.
Yes, long time ago in optimized mode some introspection info was stripped out from compiled bytecode to speed up execution, but that time long gone. If you don't believe me, read Guido van Russum's book that I quoted in this topic. Or Guido is not enough authority for you in Python?
Quote:Any developer that puts a run-time dependency on assert in their code needs calling out, and not the Kodi developers.
If you want a debug build of Kodi then build it yourself rather than develop with a release build.
I don't give a... nything about debug or release builds of Kodi. I'm talking about the Python runtime that is built-in in Kodi behaving consistently with all mainstream CPython implementations. That's all.