[Tutor] the use of the COLON

Mats Wichmann mats at wichmann.us
Thu May 11 19:18:03 EDT 2023


On 5/11/23 16:00, john fabiani wrote:
> This is going to take a lot of study!
> Thanks,
> Johnf

That reference probably isn't the most helpful - it's "canonical", but 
not that descriptive.

Python has support for (static) typing, but it's optional: the language 
itself doesn't deal with it(*), it's intended for 3rd party tools. As a 
result, the typing annotations which have gradually crept in over 
several Python releases since 3.5 are "ignored", so if you use that 
syntax, it still "works".

There are many more gentle introductions to typing in Python, worth 
taking a look on the internet.

(*) kind of a small lie... Python does process the typing syntax, but 
puts it somewhere and doesn't do anything with it beyond that.

> On 5/11/23 12:40 PM, Mats Wichmann wrote:
>> On 5/11/23 13:29, john fabiani wrote:
>>> Hi,
>>> I have never seen the following syntax.   But it works!  Can someone 
>>> explain how it works or provide a link that have me understand what 
>>> is happening?
>>> Thanks
>>> Johnf
>>> dummy_user_list: list=[["johnf", "jfabiani1947"]]
>>
>> https://docs.python.org/3/library/typing.html


More information about the Tutor mailing list