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....@python.org> on 
behalf of avi.e.gr...@gmail.com <avi.e.gr...@gmail.com>
Date: Monday, October 10, 2022 at 10:11 PM
To: python-list@python.org <python-list@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.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to