What is a good way to overload operators in python?

I want to overload the multiplication operator of a vector. At the same time, you can calculate the vector vector, and the vector float
v is the vector

.
    def __mul__(v1, v2):
        return vec3(v1.e[0]*v2.e[0],v1.e[1]*v2.e[1],v1.e[2]*v2.e[2])
    def __mul__(v, t):
        return vec3(t*v.e[0],t*v.e[1],t*v.e[2])

there is obviously a problem with this way of writing. Is there any good solution?

..
add
thanks to Chen Li for his answer. According to the idea in stackoverflow, the code has been modified as follows.

    def __mul__(v, par):
        if(isinstance(par,vec3)):
            return vec3(v.e[0] * par.e[0], v.e[1] * par.e[1], v.e[2] * par.e[2])
        else:
            return vec3(par*v.e[0],par*v.e[1],par*v.e[2])

I wonder if there are any other ideas? Is there a way to implement similar overloading functions directly from the parameters?

Mar.12,2021

you can deal with your requirements differently by judging the type of parameters.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea985f-1f61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea985f-1f61.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?