@garry23
Wow ! Your trick is genial

!
It doesn't require a lens move => seems perfect.
(Side note : I don't know if camera.shoot doesn't return something undocumented too

)
I love the idea of "estimating" the number of focus brackets beforehand

; I'll test it for sure and report to you.
I have many questions on focusing and it's use in your script, but I have a hard time writing them...

:
- I would love to see equations of focal point, near focus, far focus where diffraction is taken into account ?
- do you know the (approximate) formula of the focal point distance in function of the rotation of the focus barrel ; this is important in the near infinity range even if it is approximate. Or, do you have another idea of what could be done in that range. My concern is that it is no more possible to "interpolate" with "infinity"

... we have to extrapolate as correctly as possible... The variation of the focal distance becomes more and more important and less and less precise for one single step move: the "near focus" is the only variable that remains "finite" and tends to hyperfocal/2 ? Have others found an (obviously incomplete) answer to this question ?
- I will try if the number of brackets estimated is (approximately) what actually occurs (it's fair, isn't it

)
- this one... : if I use AF and focus on an object, do you think the exact lens focusing point can lie between two stepping motor positions ? In other words, the AF can be more precise than the discrete nature of a stepping motor which, say with lens.focus(1,1), will go from one position to the next but cannot go in between (the first argument is an integer, not a real number (evident)). Or in other words, is lens.focus(1,1) the smallest step achievable by the lens focusing mechanism ? (I know it is Canon expertise but we can have ideas on the subject: phase focusing loop/ nowadays, everything is digital,...)
- the same question arises with manual focus as the manual move is "analogical" rather than digital, or is it converted anyway into digital move ? (It depends on the lens but for new L lenses, for instance)