[Python-ideas] Augmented assignment syntax for objects.

Steven D'Aprano steve at pearwood.info
Thu Apr 27 19:28:55 EDT 2017


On Wed, Apr 26, 2017 at 08:52:46PM -0400, Juancarlo Añez wrote:

> In my experience, what Python is lacking is a way to declare attributes
> outside of the constructor. Take a look at how it's done in C#, Swisft, or
> Go.

Since you apparently already know how they do it, how about telling us 
(1) how they do it, and (2) *why* they do it?


> Object attributes outside of the constructor would solve things more
> relevant than the vertical space used when assigning constructor parameters
> to attributes. 

Solve which things?


> For example, multiple inheritance is well designed in
> Python, except that it often requires constructors with no parameters,
> which leads to objects with no default attributes.

Can you elaborate?



-- 
Steve


More information about the Python-ideas mailing list