In Python, the builtin classes have alias-like things.
The str
class can be used as:
print(str("hi"))
,
but there is an alias so you can just use:
print("hi")
.
There is also an alias for dict
:
You can use dict()
or {}
.
I have my own class, myClass()
I can call it using myClass(a=1,b=2)
, but I want to be able to use it like:
- a=1, b=2 -
or
-
a=1,
b=2
-
The character doesn't need to be -
, I just chose it as an example.
My class can accept any number of arguments, so if it is possible I want to also be able to make an empty myClass like this: --
and the ability for it to take as many args as needed:
-
a=1,
b=2,
c=3,
d=4,
e=5,
...
-