What are some strategies to write python code that works in CPython, Jython and IronPython

前端 未结 6 1979
忘了有多久
忘了有多久 2021-02-02 14:55

Having tries to target two of these environments at the same time I can safely say the if you have to use a database etc. you end up having to write unique code for that environ

6条回答
  •  耶瑟儿~
    2021-02-02 15:05

    I write code for CPython and IronPython but tip should work for Jython as well.

    Basically, I write all the platform specific code in separate modules/packages and then import the appropriate one based on platform I'm running on. (see cdleary's comment above)

    This is especially important when it comes to the differences between the SQLite implementations and if you are implementing any GUI code.

提交回复
热议问题