Closed jamiebull1 closed 10 years ago
Thanks, yeah, saw that a while back. It's unfortunate because if we fix it now a lot of scripts out there will fail. Maybe it's the price we will have to pay. Let me get back to you.
Maybe copy it, fix the name on one version, and add a deprecation warning message to the other for a few releases? On May 2, 2014 8:07 AM, "Anders Malmgren" notifications@github.com wrote:
Thanks, yeah, saw that a while back. It's unfortunate because if we fix it now a lot of scripts out there will fail. Maybe it's the price we will have to pay. Let me get back to you.
— Reply to this email directly or view it on GitHubhttps://github.com/AndersMalmgren/FreePIE/issues/21#issuecomment-41997424 .
Or hide the deprecated version from code completion. That way no new scripts will use them but the old scripts will still run
That sounds like a good approach. On May 2, 2014 11:07 AM, "Anders Malmgren" notifications@github.com wrote:
Or hide the deprecated version from code completion. That way no new users will use them but the scripts will still run
— Reply to this email directly or view it on GitHubhttps://github.com/AndersMalmgren/FreePIE/issues/21#issuecomment-42012671 .
Can this do it?
Is filters.continousRotation
calling filters.continuousRotation
there? The deprecation warning looks right, but to avoid breaking backwards compatibility the typo function should just pass through the arguments to the correct one. It looks like that's what your doing but just making sure.
So you end up with:
import warnings
class filters:
...
def continousRotation(input_pos):
''' This function will be deprecated from the next major version. Use continuousRotation instead '''
warnings.warn("This function will be deprecated from v2.0.0", PendingDeprecationWarning)
return continuousRotation(input_pos)
def continuousRotation(input_pos):
''' Proper doc string '''
# Whatever the code is
return continuous_pos
You can use either continuousRotation
or continousRotation
but the latter will result in warning
Perfect.
Oh, and warnings wont stop the script, just output in error window
The method name
continousRotation
should probably becontinuousRotation
as it's crying out for being mistyped as it stands.