I'd like to add Python 3.5 type hints for dynamically generated object attributes, so that IDEs correctly autocomplete them. Here by "dynamical" I mean that the attribute is not present during class creation or in __init__
or any other method.
E.g. is there a way to add these through comments or other tricks? If not I can fallback to add dummy class attributes.
Example::
class Request:
"""Example HTTP request object.
We have `get_user()` but we do not declare it anyhere.
"""
...
# Pyramid's way of plugging in methods and properties to request, enabled addon capabilities for the framework
# adds Request.user - done in different part of application lifecycle, not during class creation
config.add_request_method(auth.get_user, 'user', reify=True)
The goal is to make this work so that PyCharm and other IDEs would complete this attribute.