Decorator syntax for type casting in decorators by emmeowzing · Pull Request #490 · python/typing · GitHub
Skip to content

Decorator syntax for type casting in decorators - #490

Closed
emmeowzing wants to merge 1 commit into
python:masterfrom
emmeowzing:castto_decorator
Closed

emmeowzing wants to merge 1 commit into
python:masterfrom
emmeowzing:castto_decorator

Conversation

@emmeowzing

@emmeowzing emmeowzing commented Oct 29, 2017 •

Copy link
Copy Markdown

I don't know if this is the proper way to write this, but I was writing a decorator and thought, wait, if I can use functools.wraps as a decorator, why can't I use typing.cast as a decorator? I understand it's meant to be as fast as possible, but I'm sure decorating as in the following kind of way wouldn't slow things down too much. Also, I'm really just hoping to start the discussion, because I haven't been able to find anything about it on GitHub or by Googling.

@the-knights-who-say-ni

Copy link
Copy Markdown

@ilevkivskyi

Copy link
Copy Markdown
Member

Thanks! I think this looks like a duplicate of something already being discussed @declared_type, see python/peps#242 and python/mypy#3291. Normally, opening an issue before a PR would save some efforts.

@emmeowzing

Copy link
Copy Markdown
Author

Okay I'll remember that next time!

@ilevkivskyi

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants