[vtk-developers] Handling deprecated methods in Python.

Andrew Maclean andrew.amaclean at gmail.com
Thu Sep 21 01:38:09 EDT 2017


I know that they already print a warning but I wanted those using older
versions of VTK to note that the change is coming up.

Also often when running tests the warning is displayed very briefly. For
example when using *vtk.test.Testing* I want to basically just use
*vtk.vtkOutputWindow()* for important messages and still alert users to the
future change if they are running old versions of VTK by reading the code
or perhaps printing to the console.
I hope this makes sense!

On Thu, Sep 21, 2017 at 3:17 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Andrew,
>
> Deprecated methods already print a warning if they are declared with
> VTK_LEGACY().  Is there a reason that we would want the methods to live
> longer in Python than they do in C++?
>
>  - David
>
> On Wed, Sep 20, 2017 at 5:55 PM, Andrew Maclean <andrew.amaclean at gmail.com
> > wrote:
>
>> What is the best way to handle deprecated methods?
>>
>> I'm thinking of doing this:
>>
>> try:
>>     windowToImageFilter.SetScale(1)
>> except NameError:
>>     print('windowToImageFilter.SetMagnification() is deeprecated in VTK8.1')
>>     windowToImageFilter.SetMagnification(1)
>>
>> The thinking here is that if a deprecated method is ultimately removed,
>> this will still work.
>> ​Any better ideas?​
>>
>
>


-- 
___________________________________________
Andrew J. P. Maclean

___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170921/cf982ccf/attachment-0001.html>


More information about the vtk-developers mailing list