[Python-Dev] Type annotations and metaclasses
Ivan Levkivskyi
levkivskyi at gmail.com
Fri Mar 3 17:29:21 EST 2017
More information about the Python-Dev mailing list
Fri Mar 3 17:29:21 EST 2017
- Previous message (by thread): [Python-Dev] Type annotations and metaclasses
- Next message (by thread): [Python-Dev] PEP 538: Coercing the legacy C locale to a UTF-8 based locale
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Thomas, I think this question is more appropriate for mypy or typing trackers: https://github.com/python/mypy/issues https://github.com/python/typing/issues -- Ivan On 3 March 2017 at 22:56, Thomas Hauk <THauk at copperleaf.com> wrote: > I’ve read through PEPs 483, 484, and 526, but I don’t see any discussion > of how type hints should work when the type of a class member differs from > the type of an instance member, like when metaclasses are used to create > instances. > > > > e.g.: > > > > >>> from django.db import models > > >>> class MyModel(models.Model): > > ... name = models.CharField() > > ... class Meta: > > ... app_label = "myapp" > > ... > > >>> type(MyModel.name) > > <class 'django.db.models.query_utils.DeferredAttribute'> > > >>> m = MyModel() > > >>> type(m.name) > > <class 'str'> > > > > In this case, I would like to be able to specify an instance type of str > for MyModel.name. > > > > Can someone point me to any existing relevant discussion? Or if not, where > should a new discussion start? > > > > T > > > > _______________________________________________ > Python-Dev mailing list > Python-Dev at python.org > https://mail.python.org/mailman/listinfo/python-dev > Unsubscribe: https://mail.python.org/mailman/options/python-dev/ > levkivskyi%40gmail.com > > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20170303/b3fc05ca/attachment.html>
- Previous message (by thread): [Python-Dev] Type annotations and metaclasses
- Next message (by thread): [Python-Dev] PEP 538: Coercing the legacy C locale to a UTF-8 based locale
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list