-
Notifications
You must be signed in to change notification settings - Fork 288
Welcome to Python Type School! #826
-
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 a gitter 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 the typing-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:
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 9
Replies: 2 comments 4 replies
-
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 that simple_obj is of type ObjWithMethod in the following script:
class ObjWithTask:
def __init__(self, ii: int = 0):
self._ii = ii
def get_id(
self,
):
return self._ii
def 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
Beta Was this translation helpful? Give feedback.
All reactions
-
@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.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@srittau Please consider pinning this discussion to the top of the list.
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
Hah, I see, I had no idea that header was even clickable. Good old banner blindness.
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1