Skip to content

Set attribute values using kwargs when initializing objects by default

Latest
Compare
Choose a tag to compare
@zganger zganger released this 22 Aug 21:55
· 15 commits to master since this release
2305fcd

When initializing a Compysition object, you can override the default values by providing any attribute value as a kwarg, such as house = House(color=Color.WHITE) by default, without creating a custom init function for your class. Assignment will fail if the value does not match the expected attribute type.