Idea about method parameters

Toby Dickenson tdickenson at
Wed Sep 26 11:56:20 CEST 2001

Markus Schaber <markus at> wrote:

>in my Code, I very often have constructs like
>class A:
>    def m(self, value):
>        self.value = value
>        # some other work to be done
>This is annoying especially when having lots of parameters, which often 
>happens in __init__ methods.
>Now I'd love to have the possibility to shorten this by typing:
>class A:
>    def m(self, self.value):
>        pass # or the other work to be done

I assume you would not want to allow:

class A:
    def __init__(self, some_other_object.value):

But the distinction between the two is unexpected.

There is a way to shorten a __init__ with many parameters within the
current language, without sacrificing readability. Shorter, but also

class A:
    def __init__(self, value1, value2, value3):
	self.value1,self.value2,self.value3 = value1,value2,value3

(my appologies if you already knew of this)

Toby Dickenson
tdickenson at

More information about the Python-list mailing list