Madara: I see a lot of good stuff in your posts, but I feel you fail to explain them, which makes them seem pretty much respectless or useless or both.
I.e. you bash at Kulvers post, but give no arguments why it is wrong in your eyes.
You say "Please, Python is not Java", but don't explain anything. Be so kind and explain your thoughts to others and people will see it as a chance to either agree with you and get better by learning from your posts or they will disagree and may give you the opportunity to learn by their own arguments.
I think you miss the point with advising itertools. The original question was about why the program is slow, not how to implement the same functionality in another way. Yes, it is shorter if you use this, but no, the TO won't learn why there is a problem in his code if you just smash your own code at him without any explanation (other than "Python is not [insert your language here]").
Furthermore:
Python is compiled, at least in its probably most used implementation which is CPython. Even if you type python myprogram.py it will first be compiled to bytecode and this bytecode is interpreted afterwards (in case of CPython).
For Java it is the same, but there is more optimization going on and it uses JIT (compilation to native code at runtime). That makes a real boost in performance and can in some cases outperform a purley compiled language implementation, because it is able to adapt the compilation at runtime as well based on the things that happened in the past. As CPython doesn't use JIT by now, it is indeed slow.
But in most cases not that slow that it matters and in the case of Matriplex' code there is another underlying problem (I believe ande got his finger on the right spot).
when you say "my post ar right and your curved"...You confirm that you do not know the subject..Please learn before comment
Kulver didn't say he was right, he said his comment is straight (to the point), while yours isn't and I have to agree with him.
You confirm that you do not know the subject..Please learn before comment
So far you didn't confirm either that you know the subject. Do you see why this is respectless?
Phage obviously Python is slower then a compiled language, such C ,, CLisp & company but also C/C++ are slower then Assembly, or CLR…then you prefer write your SW in pure machine language?..perhaps for a rootkit…in this case an assembly C inline only to access specific CPU registers…but only small chunks.
eventually in this case when You use *itertools*'s methods for simple or complex iteration, speed will not be a your problem…make your tests guy
So, your argument is: Yes, it is slower, but no, it is not slower.
Maybe you meant it right, but the way you write it *facepalm*
itertools is written in C. Testing it is no proof that Python is fast.