Adding Fields In a Constructor

Let your IDE add constructor arguments to your instance.

It's one of those chores...your class has an __init__ with some arguments and you need to assign them to self. What a lot of typing.

Let the IDE do it for you. As you type the argument name, hit ⌥⏎ (macOS) / Alt+Enter (Windows/Linux) and choose Add 'field' to constructor, then type the next argument. Or later, put the cursor on each argument and invoke it. PyCharm will create the assignment for you.


Related Resources

See VCS Changed Lines In Gutter
Quickly spot which parts of your file have changed since the last commit.
Split Screen Without Tabs
Get your code and tests side-by-side without resorting to tabs.
Run From Keyboard
Use the keyboard to select and run a run configuration.