<p>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 environment. Have you got a great way to handle this situation?</p>

[{'answer_id': 53549, 'author': 'Daren Thomas', 'author_id': 2260, 'author_profile': 'https://Stackoverflow.com/users/2260', 'pm_score': 4, 'selected': False, 'text': "<p>If you <em>do</em> find you need to write unique code for an environment, use pythons </p>\n\n<pre><code>import mymodule_jython as mymodule\n\nimport mymodule_cpython as mymodule\n</code></pre>\n\n<p>have this stuff in a simple module (''module_importer''?) and write your code like this:</p>\n\n<pre><code>from module_importer import mymodule\n</code></pre>\n\n<p>This way, all you need to do is alter <code>module_importer.py</code> per platform.</p>\n"}, {'answer_id': 55312, 'author': 'cdleary', 'author_id': 3594, 'author_profile': 'https://Stackoverflow.com/users/3594', 'pm_score': 3, 'selected': False, 'text': '<p>@Daren Thomas: I agree, but you should use the <a href="http://docs.python.org/dev/library/platform.html#platform.python_implementation" rel="nofollow noreferrer">platform module</a> to determine which interpreter you\'re running.</p>\n'}, {'answer_id': 199275, 'author': 'CyberFonic', 'author_id': 23999, 'author_profile': 'https://Stackoverflow.com/users/23999', 'pm_score': 2, 'selected': False, 'text': "<p>I write code for CPython and IronPython but tip should work for Jython as well.</p>\n\n<p>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)</p>\n\n<p>This is especially important when it comes to the differences between the SQLite implementations and if you are implementing any GUI code.</p>\n"}, {'answer_id': 342835, 'author': 'Jason Baker', 'author_id': 2147, 'author_profile': 'https://Stackoverflow.com/users/2147', 'pm_score': 1, 'selected': False, 'text': "<p>The #1 thing IMO:  <strong>Focus on thread safety</strong>.  CPython's GIL makes writing threadsafe code easy because only one thread can access the interpreter at a time.  IronPython and Jython are a little less hand-holding though.</p>\n"}, {'answer_id': 342845, 'author': 'OscarRyz', 'author_id': 20654, 'author_profile': 'https://Stackoverflow.com/users/20654', 'pm_score': 0, 'selected': False, 'text': '<p>I\'m pretty sure you already know this but unfortunately Jython <a href="http://www.jython.org/Project/userfaq.html#is-jython-the-same-language-as-python" rel="nofollow noreferrer">can\'t load c extension modules.</a></p>\n'}, {'answer_id': 637549, 'author': 'Arafangion', 'author_id': 52273, 'author_profile': 'https://Stackoverflow.com/users/52273', 'pm_score': 0, 'selected': False, 'text': '<p>There are two <em>major</em> issues at play here...</p>\n\n<p>Firstly, to my knowledge, only CPython has RAII - you have to close your own resources in Jython, Ironpython, etc.</p>\n\n<p>And Secondly, as has been mentioned, is thread safety.</p>\n'}]
['https://Stackoverflow.com/questions/53543', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4491/']