Your IP : 216.73.216.213
3
� f� � @ s$ d Z G dd� d�Zdd� Ze� dS )zA
A demonstration of classes and their special methods in Python.
c @ sX e Zd ZdZdd� Zedd� �Zdd� Zdd � Zd
d� Z dd
� Z
dd� Zdd� ZeZ
dS )�Vecaw A simple vector class.
Instances of the Vec class can be constructed from numbers
>>> a = Vec(1, 2, 3)
>>> b = Vec(3, 2, 1)
added
>>> a + b
Vec(4, 4, 4)
subtracted
>>> a - b
Vec(-2, 0, 2)
and multiplied by a scalar on the left
>>> 3.0 * a
Vec(3.0, 6.0, 9.0)
or on the right
>>> a * 3.0
Vec(3.0, 6.0, 9.0)
c G s t |�| _d S )N)�list�v)�selfr � r �6/opt/alt/python36/lib64/python3.6/Tools/demo/vector.py�__init__ s zVec.__init__c C s t |t�st�| � }||_|S )N)�
isinstancer � TypeErrorr )�clsr Zinstr r r �fromlist"