What to use for finding as many syntax errors as possible.

Weatherby,Gerard gweatherby at uchc.edu
Tue Oct 11 07:26:15 EDT 2022


Sure it does. They’re optional and not enforced at runtime, but I find them useful when writing code in PyCharm:

import os
from os import DirEntry

de : DirEntry
for de in os.scandir('/tmp'):
    print(de.name)

de = 7
print(de)

Predeclaring de allows me to do the tab completion thing with DirEntry fields / methods

From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of avi.e.gross at gmail.com <avi.e.gross at gmail.com>
Date: Monday, October 10, 2022 at 10:11 PM
To: python-list at python.org <python-list at python.org>
Subject: RE: What to use for finding as many syntax errors as possible.
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

Michael,

A reasonable question. Python lets you initialize variables but has no
explicit declarations.


More information about the Python-list mailing list