[Libre-soc-bugs] [Bug 1094] insndb instruction database visitor-walker is needed

bugzilla-daemon at libre-soc.org bugzilla-daemon at libre-soc.org
Sat Jun 3 19:11:00 BST 2023


--- Comment #25 from Luke Kenneth Casson Leighton <lkcl at lkcl.net> ---
(In reply to Dmitry Selyutin from comment #24)

> One might argue that this is issue related to implementation (Python should
> not bring module's internals atop of sys.path list); 

they likely feel they had to get it to the front of sys.path
so as not to have user-imports cause problems.

if it is at the back it is still a problem but one that makes
the user's code break (because when using the module they get
the *system* module) rather than "python wudnt import mi fing"
errors which look like *python* is broken.

either way it's still a problem, but one way avoids the python devs
from getting blamed for it.

> I personally think so.
> However, Python has tools and guidelines for doing this correctly. Our
> setup.py also does the correct thing and syncs the script path too. So I
> suggest using the script as intended by PEP and setup.py and overall logic.

this i feel would be reasonable if it wasn't for running the module itself
as a way to check for syntax errors and import errors - on a standalone
basis.  i actually do this, and running a program (/usr/local/bin/...)
which imports that script isn't the same thing.

also under some circumstances, to put unit tests in.



    import unittest

    class Visitor: etc

    # create some Visitor unit tests
    class unittest.Blah(....)

    # the main import entry-point for the script pysvp64db
    def main():

    if __name__ == '__main__':

now that would be a good reason to run that script directly: to fire
the unit tests for it, which as long as they are not massive, and
are more like "use-cases", i feel are kinda ok to have right next to
the actual class itself.

do in this case we need to put (small, demo) unit tests in there?

will i try running the script to check syntax-errors and import-errors
when writing it?  yes.

You are receiving this mail because:
You are on the CC list for the bug.

More information about the libre-soc-bugs mailing list