Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 77
    Never let your IDE dictate what code you write? Commented Aug 27, 2014 at 11:24
  • 17
    By the way: using a proper python IDE (e.g. PyCharm), setting the attributes in the __init__ already provides autocompletion etc. Also, using None prevents the IDE to infer a better type for the attribute, so it's better to use a sensible default instead (when possible). Commented Aug 27, 2014 at 17:39
  • If it is just for autocompletion you can use type hinting, and the additional docstrings will be a plus too. Commented Feb 12, 2018 at 19:20
  • 3
    "Never let your IDE dictate what code you write" is a debated issue. As of Python 3.6 there's in-line annotations and a typing module, which allow you to provide hints to the IDE and linter, if that sort of thing tickles your fancy... Commented Apr 30, 2018 at 13:57
  • 2
    These assignments at class level have no effect on the rest of the code. They have no effect on self. Even if self.name or self.age were not assigned in __init__ they would not show up in the instance self, they only show up in the class Person. Commented May 27, 2018 at 9:15