1

It seems feasible to have a feature that automates the task of generating a skeleton init routine for a new class.

One approach would be to write

Class C(object):
   __init__(self, a, b, c, ...):

then hit a key or invoke a menu function that adds the code

        self.a = a
        self.b = b
        self.c = c
        ...

The programmer could then modify the generated code to deal with computations around the initial parameters.

I recognize that there are introspective approaches that achieve a similar effect at runtime, but this deprives the IDE of the ability to prompt on class member names while entering other code.

WesR
  • 1,292
  • 1
  • 18
  • 30
  • Thanks to juanpa and @Daniyal for pointing me towards Templates, a feature of which I was unaware. Thanks especially to Daniyal for managing to quickly get in a more complete answer before discussion was cut off. Mac users will find the function that Daniyal describes under Pycharm->Preferences rather than File->Settings. – WesR Aug 28 '17 at 18:20

0 Answers0