Properly Erase Pattern Via Scripting?

I can’t get to erase patterns properly. Here’s my problem :

Starting with an empty song, I clone the first pattern (no 0) using renoise.song().sequencer:clone_range. I get a new pattern (no 1). I remove it from the sequence, using renoise.song().sequencer:delete_at, then clear it with renoise.song().patterns[]:clear. When I clone the no 0 pattern again, the new cloned pattern is no 2. But I expect it to be no 1, since I erased no 1 in every possible way.

I know we have the same problem when doing this without scripting, but at least we have the “Sort and Delete Unused Patterns” function. AFAIK, you don’t have access to this function from the API, and it would be more useful for scripting if you could delete patterns one by one.

Is there any workaround for this? Is it a planned feature?

Will automatically remove such empty patterns in “renoise.song().sequencer.delete_sequence_at(sequence_pos)” in the next beta.