Efficient way of generating original alphabetic strings like unix file "split"

py_genetic conor.robinson at gmail.com
Mon Jun 18 20:23:35 EDT 2007


On Jun 14, 3:02 pm, "mensana... at aol.com" <mensana... at aol.com> wrote:
> On Jun 14, 4:39 pm, py_genetic <conor.robin... at gmail.com> wrote:
>
> > > You didn't try hard enough. :)
>
> > >http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
>
> > > --
> > > HTH,
> > > Rob
>
> > Thanks Rob, "permutation" was the keyword I shcould have used!
>
> See my other post to see if that is indeed what you mean.

Thanks, mensanator I see what you are saying, I appreciate you
clarification.  I modified the unique version to fit my needs,
sometimes you just want the first x unique combinations and of the
right "width" (A or AA or AAA...) string, so I reworked it a bit to be
more efficient.  Isn't this a case of base^n-1 for # unique
combinations, using the alphabet: 26^strlen - 1 or to figure out
strlen from #of combinations needed: ln(26 * #ofcobinations needed)/
ln(26) obviously a float but a pritty good idea of strlen needed when
rounded?




More information about the Python-list mailing list