<div dir="ltr">Hi Tal,<div><br></div><div>I'm using it for a project of my own (optimizing keyboard layout) but I can't make the case that it's useful for the stdlib. I'd understand if it would be omitted for not being enough of a common need.<br>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 6, 2014 at 6:40 PM, Tal Einat <span dir="ltr"><<a href="mailto:taleinat@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=taleinat@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">taleinat@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On Tue, May 6, 2014 at 3:45 PM, Paul Moore <<a href="mailto:p.f.moore@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=p.f.moore@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">p.f.moore@gmail.com</a>> wrote:<br>
> On 6 May 2014 10:35, Tal Einat <<a href="mailto:taleinat@gmail.com" target="_blank" onclick="window.open('https://mail.google.com/mail/?view=cm&tf=1&to=taleinat@gmail.com&cc=&bcc=&su=&body=','_blank');return false;">taleinat@gmail.com</a>> wrote:<br>
>>> Hmmm. Well, since the order of permutations is documented, I suppose my<br>
>>> objection is answered. In that case, it becomes a question of whether or<br>
>>> not there is an easy way to generate the Nth permutation without having<br>
>>> to iterate through the previous N-1 permutations.<br>
>><br>
>> Yes, it is possible using factorial decomposition of N.<br>
>><br>
>> See, for an example: <a href="http://stackoverflow.com/a/7919887/40076" target="_blank">http://stackoverflow.com/a/7919887/40076</a><br>
><br>
> For large N, this is much slower than itertools.permutations when you<br>
> only want the first few entries.<br>
<br>
</div>If someone just wants the first few entries, they probably aren't<br>
worried about it being super fast. And if they were, they could just<br>
iterate to get the first permutations.<br>
<br>
As for getting anything past the first few permutations (e.g. an<br>
arbitrary one), factorial decomposition would be faster by several<br>
orders of magnitude than iterating from the beginning. For relatively<br>
large permutations, iterating from the beginning could be unfeasible,<br>
while factorial decomposition would still take far less than a second.<br>
<br>
The real question IMO is if this is useful enough to bother including<br>
in the stdlib. For example, I don't think it would pass the "potential<br>
uses in the stdlib" test. Perhaps Ram (the OP) has some actual<br>
use-cases for this?<br>
<span><font color="#888888"><br>
- Tal<br>
</font></span></blockquote></div><br></div></div></div>