To generate new addresses raise the gap limit
It is not necessary anymore to mess with the gap limit, and I would prefer if users do not do that, because it can lead to monetary losses if they do not undersand what they are doing
In 2.0, the "New" button in the "Receive" tab allows to create addresses beyond the gap limit (and the user gets a proper warning).
And if you need to do it programatically, call
wallet.create_new_address()
(in the console or in a script)