User talk:A

From Rosetta Code
Revision as of 14:19, 15 October 2011 by A (talk | contribs) (→‎Python 3.X before 2.X in Concurrent computing)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Python 3.X before 2.X in Concurrent computing

Hi A. Your did not reply to my statement that Python 2.7 is to be the last of the 2.x versions with new development to be centred on 3.X. I understand that there are other Python versions and that they too are on Python 2.X, but if there are no reasons not to, new development should be in Python 3.X. I try and follow the spirit of the migration to 3.X. To address your statement that "2.X *is* the standard". ".X may well have more libraries and more code written for it at present, but unless one uses Python 3.X when one can, then one is doomed to always use 2.X instead of migrating to 3.X as the Python community suggests one does. Please don't revert the undo without making your case in more detail. Thanks. --Paddy3118 17:00, 10 October 2011 (UTC)

threading.Timer() solution both works on Python 2.x and 3.x and better implements the task requirements. concurrent.futures example requires to install the dependency on Python < 3.2 and it doesn't produce expected output where it works and as written it might not work on Windows (due to __main__ is not importable, I can't test that part). a__ 22:32, 14 October 2011 (UTC)

Hi again A. I reread the task description and could not see how the threading.timer better implements the task requirements? I should state that I don't think the mention of random in the task description is best addressed by adding random delays to each process/thread - I read it as a statement of the uncertainty of the order of output due to an undefined process or task running order/priority. If task order/priority is actually fixed then a random sleep may be neccessary but that is not the case for processes.
The multiprocessing example given includes the mention of the Windows version copied from the idle window. It was tested on Windows. In comparisons with other languages, I think the Python examples should try and show where the language is and where the current development is focused on. It is a judgement call, but I wouldn't think that Python 3 is deficient here. By putting Python 3 first we in effect show what we have as we think it should be and is currently implemented, followed by the wealth of older libraries that (hopefully) will be ported from 2 to 3. --Paddy3118 05:02, 15 October 2011 (UTC)

Those goals are to demonstrate the syntax for defining concurrent behavior within a single program, and the syntax for creating a random sleep or delay. --Waldorf 17:59, 7 February 2007 (MST)[1]
futures example doesn't achieve the second goal.
The remark about "importability" applies at least for multiprocessing module [2] I don't know whether it applies to futures as well.
threading.Timer is not deprecated. It is a correct code to solve this problem on 3.x. It might be good idea that the first example is both correct and copy-pasteable i.e., being able to run on both Python 2.x and 3.x without additional dependencies. I didn't remove futures example I just moved it to the second place.

--a__ 14:17, 15 October 2011 (UTC)