Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #109675
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Nagy László Zsolt <gandalf@shopzeus.com> |
| Newsgroups | comp.lang.python |
| Subject | Recursive type annotations |
| Date | Wed, 8 Jun 2016 15:02:23 +0200 |
| Lines | 26 |
| Message-ID | <mailman.77.1465390948.2306.python-list@python.org> (permalink) |
| References | <8e439d4f-182d-334d-ffbe-8c39856cdd33@shopzeus.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-2 |
| Content-Transfer-Encoding | quoted-printable |
| X-Trace | news.uni-berlin.de MaYJTQJJlnNBB4YIEdODHgDWass1OTOZLeumshNYOv5Q== |
| Return-Path | <gandalf@shopzeus.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'compiler': 0.05; 'method.': 0.05; 'rename': 0.07; 'annotations': 0.09; 'argument,': 0.09; 'ide': 0.09; 'nameerror:': 0.09; 'syntax': 0.13; 'def': 0.13; '"test"': 0.16; 'bind': 0.16; 'executed.': 0.16; 'expert,': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'subject:type': 0.16; 'byte': 0.18; 'prevent': 0.20; 'to:name :python-list@python.org': 0.20; 'recognize': 0.22; 'pass': 0.22; 'code.': 0.23; 'defined': 0.23; 'forgot': 0.23; 'thanks,': 0.24; '(e.g.': 0.27; "i'm": 0.30; 'class': 0.33; 'common': 0.33; 'definition': 0.34; 'but': 0.36; 'there': 0.36; 'child': 0.36; 'to:addr:python-list': 0.36; 'being': 0.37; 'method': 0.37; 'data': 0.39; 'build': 0.40; 'to:addr:python.org': 0.40; 'where': 0.40; 'some': 0.40; 'charset:iso-8859-2': 0.64; 'believe': 0.66; "'test'": 0.84; 'detecting': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopzeus.com; s=shopzeus_com; t=1465390941; bh=IOVK3q0udjGBPz/a0l4ZLxqnbT2vKDHo8IpzGxs+nPY=; h=To:From:Subject:Date:From; b=DwY9867+kADHLw3HQc++JHxkgHHvuH1QyFVDsvDJDVhou6+NAPSrmL3GbqerJIQa+ OlPUoR5FpOE+dXXtnooxIN74R8IQvLqfhSHMdXEZueMBb+wC8m2NBxW/h4E0dLEG2Z kcng234Wi2dypY/JeqxBNkl9I+srsPlUFrRg2oBb3W6evqJZB5Q7DoqAIHTd0/a6tP dn2Gqn9trKt/zcmhUCJwzmmFis3Y1+KOFLuphDmGGx68CzRv5CmJClLr6Nad2kP9We 7vu9v7XVde9kl+ih62PSZWorIGrKWKCsq8t1gRo0sBFlvshJTXqNGxXxiN9pDQAT6K GBH9c4r6dfHOA== |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.22 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <8e439d4f-182d-334d-ffbe-8c39856cdd33@shopzeus.com> |
| Xref | csiph.com comp.lang.python:109675 |
Show key headers only | View raw
class Test:
def test(self, child : Test):
pass
NameError: name 'Test' is not defined
I understand that the class "Test" is not defined until the class
definition is executed. But it is very very common to build recursive
data structures, and I have concrete use case where the IDE did not
recognize the type of the argument, and as a result it forgot to rename
some method calls when I auto-refactored the name of the method.
I'm not an expert, but I believe that these annotations are not used by
the byte compiler for anything. This is just pure syntax introduced for
the person who reads the code.
Is there a known obsticle that would prevent us from detecting recursive
type annotations? (E.g. bind the annotation to the class that is being
defined.)
Thanks,
Laszlo
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Recursive type annotations Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-08 15:02 +0200
Re: Recursive type annotations Jon Ribbens <jon+usenet@unequivocal.co.uk> - 2016-06-08 13:11 +0000
Re: Recursive type annotations Nagy László Zsolt <gandalf@shopzeus.com> - 2016-06-08 15:31 +0200
Re: Recursive type annotations Ian Kelly <ian.g.kelly@gmail.com> - 2016-06-08 08:58 -0600
csiph-web