"Ralf W. Grosse-Kunstleve" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> class grouping:
>
> def __init__(self, .x, .y, .z):
> # real code right here
> Emulation using existing syntax::
> def __init__(self, x, y, z):
> self.x = x
> del x
> self.y = y
> del y
> self.z = z
> del z
I think this is a bad idea, for a subtle reason.
In Python, unlike many other languages, the names of formal parameters are
part of a function's interface. For example:
def f(x, y):
return x-y
Now f(3, 4) is -1 and f(y=3,x=4) is 1.
The names of instance variables are generally not part of a class'
interface--they are part of its implementation.
This proposed feature, whenever used, would tie a class' implementation to
the interface of every method that uses the feature. As far as I can see,
it is impossible to use the feature without constraining the implementation
in this way.
For this reason, I would much rather have the mapping between parameter
names and instance variables be explicit.
--
http://mail.python.org/mailman/listinfo/python-list