Short answer: No, you cannot.
Long answer: Well, you can, but then it is not python anymore.
The complex literals are handled when parsing python. They are a well-integrated part of the python language with custom syntax. You cannot simply define your own custom syntax in python. It requires to modify your python parser, which is not an easy task I’m afraid. Also, your program would then be incompatible to other python implementations.
There have been efforts to allow users to define custom string literals (such as in C++) before, however, it never gained traction, as you could simply make the user from myquaternionlibrary import q and then use q("1 + 2j + 3k + 4h"), which is only two characters more than a custom string literal. You would implement q to parse the quaternion from a string.
The third and most tedious way would be to attempt to get Quaternions integrated in the python language. This would require to post on python-ideas (and do some research beforehands to see whether it has been discussed before and how the discussion evolved; include that in your initial discussion to prevent your thread from dying quickly) to see if your suggestions gains traction. Then follows writing a PEP and getting it approved, along with an implementation in the CPython python implementation.
(The last paragraph is basically what I figured out from reading python-ideas for a few years now, it may not be the officially documented process as I might miss some nuances or steps.)
jsuffix is part of Python's language syntax. So - unless you feel like extending core Python, the only practical way is to have yourQuaternionclass accept a string and parse it appropriately... You may find sympy of use here.1 + 2i + 3h + 4k? I'm trying to understand if capturing such syntax is possible in principle...SyntaxErrors. The only way to do it without modifying core Python is to take strings and parse them yourself.1+2jsyntax does not directly definecomplex(1,2)but is the addition of theint1 to thecomplex(0,2). It so happens that the peephole optimizer will do this operation at compile time, but lexically speaking it's not a single literal.