[Python-ideas] Augmented assignment syntax for objects.

Chris Angelico rosuav at gmail.com
Wed Apr 26 16:50:58 EDT 2017


On Thu, Apr 27, 2017 at 6:24 AM, Erik <python at lucidity.plus.com> wrote:
> The background is that what I find myself doing a lot of for private
> projects is importing data from databases into a structured collection of
> objects and then grouping and analyzing the data in different ways before
> graphing the results.
>
> So yes, I tend to have classes that accept their entire object state as
> parameters to the __init__ method (from the database values) and then any
> other methods in the class are generally to do with the subsequent analysis
> (including dunder methods for iteration, rendering and comparison etc).

You may want to try designing your objects as namedtuples. That gives
you a lot of what you're looking for.

ChrisA


More information about the Python-ideas mailing list