Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

Something else you might find useful but not covered by Yoriz's answer is this

Due to the reasons discussed here we will be moving to python-forum.io on October 1st, 2016.This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.

Thanks for your thoughful answers, particularly to Yoriz. Actually, I needed a good library with examples which I can customize to use it in my own way and can give different contraints while generating combinations. You people thought I did not even bothered search in Googles by writing simply Python Combinatorics... .... Anyway, you can see the following link if you are interested.