Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Welcome to Python Type School!#826

Aug 9, 2021· 2 comments· 4 replies
Discussion options

Welcome to Python Type School!

This is a place where you can ask questions about optional typing with Python. 🐍 Any questions are welcome, but you might want to look through existing discussions, your question might already have an answer! We also have agitter channel if you are looking for a more interactive form of help.

Our discussion categories are:

  • Q&A where you can ask question about typing or help others.
  • Reviews where you can ask others to review your typing-related patches or pull requests.
  • General for all other typing-related discussions. But please note that ideas about improving Python's typing are best directed to thetyping-sig mailing list. Historically,the issues in this repository had discussions about new features as well, but new discussions should be started on the mailing list.

For more information about typing see the following resources:

You must be logged in to vote

Replies: 2 comments 4 replies

Comment options

Is there a python api for mypy that can be used to get types of variables?
Context:
I want to infer the type of variables inside a python script, for example, I would like to be able to know thatsimple_obj is of typeObjWithMethod in the following script:

class ObjWithTask:    def __init__(self, ii: int = 0):        self._ii = ii    def get_id(        self,    ):        return self._iidef my_func():    simple_obj = ObjWithTask(ii=3)    object_id = simple_obj.get_id()    return [object_id]

Is it possible to do? I know that VSCode is able to infer that, however I am not sure how it does it, if it uses proprietary code from Pylance or Pyright. Any comments or suggestions are welcome

You must be logged in to vote
1 reply
@jeremyn
Comment options

@juanchoflorez This is just an announcement thread for this board, it's not really a place for questions. Could you repost your comment in a new thread? Feel free to @ me there, I have an idea that might help you.

Comment options

@srittau Please considerpinning this discussion to the top of the list.

You must be logged in to vote
3 replies
@srittau
Comment options

srittauNov 3, 2022
Maintainer Author

The discussion is actually pinned. Unfortunately, pinned discussions are displayed in form of a large header, so that it's easy to overlook, despite them being so prominent.

@jeremyn
Comment options

Hah, I see, I had no idea that header was even clickable. Good oldbanner blindness.

@srittau
Comment options

srittauNov 3, 2022
Maintainer Author

I have to admit, when I just checked, I didn't see the pinned discussion either, only when I noticed that it said "Unpin discussion" instead of "Pin discussion" I looked closer. I prefer the typical pinning of other forums, where the pinned discussions are just at the front of the list, maybe with a slightly different background.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
3 participants
@srittau@jeremyn@juanchoflorez

[8]ページ先頭

©2009-2025 Movatter.jp