Iain King <[EMAIL PROTECTED]> wrote:

> FTR, I won't be using this :)  I do like this syntax though:
> 
> class Vector:
>     def __init__(self, x, y, z):
>         self.x = x
>         self.y = y
>         self.z = z
>     def abs(self):
>         using self:
>             return math.sqrt(.x*.x + .y*.y + .z*.z)

It is a bit verbose though. This variant is shorter on my system[*]:

class Vector:
    def __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z
    def abs(self):
        return math.sqrt(self.x*self.x + self.y*self.y + self.z*self.z)

[*] Windows, they are the same length on Linux.

:)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to