the annoying, verbose self

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Nov 24 07:29:39 CET 2007


On Fri, 23 Nov 2007 20:48:06 -0800, Kay Schluehr wrote:

> I like this pattern but less much I like the boilerplate. What about
> an explicit unpacking protocol and appropriate syntax?
> 
> def abs(self):
>      x, y, z by self
>      return math.sqrt(x**2 + y**2 + z**2)
> 
> expands to
> 
> def abs(self):
>      x, y, z = self.__unpack__("x","y","z")
>      return math.sqrt(x**2 + y**2 + z**2)

What about ``from`` instead of ``by``?  That's already a keyword so we
don't have to add a new one.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list