This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author YoSTEALTH
Recipients YoSTEALTH
Date 2016-12-03.20:48:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480798125.09.0.140898215567.issue28861@psf.upfronthosting.co.za>
In-reply-to
Content
Type Hints Syntax
-----------------

Goal: Is to make it easy to read function/methods arguments, yet keep the new and cool Type Hints.

For example this is a code from one of my function. Its getting to that point of what the heck is going on here?

def find_replace(string: str, find: (str, dict, list, tuple, set), replace: (str, list, tuple, set)='') -> str:
    pass

I know it can be rewritten as:

T = (str, dict, list, tuple, set)
def find_replace(string: str, find: T, replace: T='') -> str:
    pass

But when you start using variable to represent another variables type... maybe we are losing the plot here!

What if we could have both? Readability and type reference, what if it could be written as:

def find_replace(string, find, replace):
    targ str, *(str, dict, list, tuple, set) -> str
    # code here ...

targ = type argument (like *args and **kwargs)

Calling a "targ" like we call "global" but to represent types.

Simple Examples:

def Redirect(url='', code=301):
    targ (str, int) -> None


Just think about it...
History
Date User Action Args
2016-12-03 20:48:45YoSTEALTHsetrecipients: + YoSTEALTH
2016-12-03 20:48:45YoSTEALTHsetmessageid: <1480798125.09.0.140898215567.issue28861@psf.upfronthosting.co.za>
2016-12-03 20:48:45YoSTEALTHlinkissue28861 messages
2016-12-03 20:48:44YoSTEALTHcreate