[Python-ideas] Augmented assignment syntax for objects.
Erik
python at lucidity.plus.com
Wed Apr 26 16:24:46 EDT 2017
On 26/04/17 16:10, Nick Timkovich wrote:
> I was wondering that if there are so many arguments to a function that
> it *looks* ugly, that it might just *be* ugly.
>
> For one, too many required arguments to a function (constructor,
> whatever) is already strange. Binding them as attributes of the object,
> unmodified in a constructor also seems to be rare.
Yes, and perhaps it's more of a problem for me because of my
possibly-atypical use of Python.
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).
E.
More information about the Python-ideas
mailing list