We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
GitHub fields:
assignee = None closed_at = <Date 2016-12-04.01:40:01.006> created_at = <Date 2016-12-03.20:48:45.049> labels = ['type-feature'] title = 'Type Hints Syntax' updated_at = <Date 2016-12-04.01:40:00.992> user = 'https://github.com/YoSTEALTH'
bugs.python.org fields:
activity = <Date 2016-12-04.01:40:00.992> actor = 'YoSTEALTH' assignee = 'none' closed = True closed_date = <Date 2016-12-04.01:40:01.006> closer = 'YoSTEALTH' components = [] creation = <Date 2016-12-03.20:48:45.049> creator = 'YoSTEALTH' dependencies = [] files = [] hgrepos = [] issue_num = 28861 keywords = [] message_count = 2.0 messages = ['282304', '282313'] nosy_count = 1.0 nosy_names = ['YoSTEALTH'] pr_nums = [] priority = 'normal' resolution = None stage = None status = 'closed' superseder = None type = 'enhancement' url = 'https://bugs.python.org/issue28861' versions = []
The text was updated successfully, but these errors were encountered:
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...
Sorry, something went wrong.
I was told to post this in python-ideas and also i totally missed the most important part (type aliases) in my example (rushed it)
No branches or pull requests
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: