Skip to content

Commit

Permalink
deploy: 766f158
Browse files Browse the repository at this point in the history
  • Loading branch information
ringohoffman committed Sep 5, 2023
1 parent 410b6a2 commit e09f6f1
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 16 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## Background and Motivation

I recently had a conversation with a few of my coworkers where I had mentioned that Python is a strongly typed language. One of them didn't think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my coworkers and I are experienced Python developers, none of us had a clear understanding of strong typing. This inspired me to write this post to help disambiguate Python and its runtime and static type systems.
I recently had a conversation with a few of my colleagues where I had mentioned that Python is a strongly typed language. One of them didn't think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my colleagues and I are experienced Python developers, none of us had a clear understanding of strong typing. This inspired me to write this post to help disambiguate Python and its runtime and static type systems.

## Compiled vs. Interpreted Languages

Expand Down Expand Up @@ -247,6 +247,28 @@ go_flying(duck) # OK
go_flying(person) # static typing error: "fly" is not present
```

## Recap

> Is Python an interpreted language?
Python is considered an interpreted language because its reference implementation, CPython, compiles Python code into bytecode at runtime before interpreting it.

> Is Python a dynamically typed language?
Python is a dynamically typed language because it allows variables to be reassigned to values of different types.

> Is Python a strongly typed language?
Python is considered a strongly typed language because most type changes require explicit conversions.

> Is Python's static type system nominally or structurally typed?
Python's static type system is generally nominally typed, but `collections.abc` provides a collection of useful structural types, and `typing.Protocol` provides a way to define custom structural types.

> Is Python a duck typed language?
Python's runtime type system is duck typed because it determines type compatibility by checking only the parts of an object's structure that are accessed at runtime.

## Sources

<a id="1"></a>[1] [Wikipedia: Interpreter (computing)](https://en.wikipedia.org/wiki/Interpreter_(computing))
Expand Down
2 changes: 1 addition & 1 deletion categories/python/index.xml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Python - Category - Blogu</title><link>https://ringohoffman.github.io/categories/python/</link><description>Python - Category - Blogu</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>[email protected] (Matthew Hoffman)</managingEditor><webMaster>[email protected] (Matthew Hoffman)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Thu, 17 Aug 2023 19:00:00 -0800</lastBuildDate><atom:link href="https://ringohoffman.github.io/categories/python/" rel="self" type="application/rss+xml"/><item><title>Python: A Strongly, Dynamically, Duck Typed, Interpreted Language</title><link>https://ringohoffman.github.io/01-python-a-strongly-dynamically-duck-typed-interpreted-language/</link><pubDate>Thu, 17 Aug 2023 19:00:00 -0800</pubDate><author><name>Matthew Hoffman</name></author><guid>https://ringohoffman.github.io/01-python-a-strongly-dynamically-duck-typed-interpreted-language/</guid><description>Background and MotivationI recently had a conversation with a few of my coworkers where I had mentioned that Python is a strongly typed language. One of them didn&amp;rsquo;t think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my coworkers and I are experienced Python developers, none of us had a clear understanding of strong typing.</description></item></channel></rss>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Python - Category - Blogu</title><link>https://ringohoffman.github.io/categories/python/</link><description>Python - Category - Blogu</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>[email protected] (Matthew Hoffman)</managingEditor><webMaster>[email protected] (Matthew Hoffman)</webMaster><copyright>This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.</copyright><lastBuildDate>Thu, 17 Aug 2023 19:00:00 -0800</lastBuildDate><atom:link href="https://ringohoffman.github.io/categories/python/" rel="self" type="application/rss+xml"/><item><title>Python: A Strongly, Dynamically, Duck Typed, Interpreted Language</title><link>https://ringohoffman.github.io/01-python-a-strongly-dynamically-duck-typed-interpreted-language/</link><pubDate>Thu, 17 Aug 2023 19:00:00 -0800</pubDate><author><name>Matthew Hoffman</name></author><guid>https://ringohoffman.github.io/01-python-a-strongly-dynamically-duck-typed-interpreted-language/</guid><description>Background and MotivationI recently had a conversation with a few of my colleagues where I had mentioned that Python is a strongly typed language. One of them didn&amp;rsquo;t think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my colleagues and I are experienced Python developers, none of us had a clear understanding of strong typing.</description></item></channel></rss>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
<a href=javascript:void(0); class="search-button search-clear" id=search-clear-mobile title=Clear><i class="fas fa-times-circle fa-fw"></i></a>
<span class="search-button search-loading" id=search-loading-mobile><i class="fas fa-spinner fa-fw fa-spin"></i></span></div><a href=javascript:void(0); class=search-cancel id=search-cancel-mobile>Cancel</a></div><a class=menu-item href=/posts/ title>Posts</a><a class=menu-item href=/tags/ title>Tags</a><a class=menu-item href=/categories/ title>Categories</a><a class=menu-item href=/about/ title>About</a><a class=menu-item href=/matthewhoffman_resume.pdf title>Resume</a><a class=menu-item href=https://github.com/ringohoffman/ringohoffman.github.io title=Source rel="noopener noreferrer" target=_blank><i class='fab fa-github fa-fw' aria-hidden=true></i></a><a href=javascript:void(0); class="menu-item theme-switch" title="Switch Theme">
<i class="fas fa-adjust fa-fw"></i></a></div></div></header><div class="search-dropdown desktop"><div id=search-dropdown-desktop></div></div><div class="search-dropdown mobile"><div id=search-dropdown-mobile></div></div><main class=main><div class=container><div class="page home" posts><div class=home-profile><div class=home-avatar><a href=/posts/ title=Posts><img loading=eager src=/blogu.svg srcset="/blogu.svg, /blogu.svg 1.5x, /blogu.svg 2x" sizes=auto alt=/blogu.svg title=/blogu.svg height=100 width=100></a></div><h2 class=home-subtitle>A place where I document my learnings</h2><div class=links><a href=https://github.com/ringohoffman title=GitHub target=_blank rel="noopener noreferrer me"><span class="fab fa-github-alt fa-fw"></span></a><a href=https://twitter.com/ringohoffman title=Twitter target=_blank rel="noopener noreferrer me"><span class="fab fa-twitter fa-fw"></span></a><a href=https://www.instagram.com/ringohoffman title=Instagram target=_blank rel="noopener noreferrer me"><span class="fab fa-instagram fa-fw"></span></a><a href=mailto:[email protected] title=Email rel=me><span class="far fa-envelope fa-fw"></span></a></div></div><article class="single summary" itemscope itemtype=http://schema.org/Article><h1 class=single-title itemprop="name headline"><a href=/01-python-a-strongly-dynamically-duck-typed-interpreted-language/>Python: A Strongly, Dynamically, Duck Typed, Interpreted Language</a></h1><div class=post-meta><span class=post-author><span class="author fas fa-user-circle fa-fw"></span><a href=../about title=Author rel=author class=author>Matthew Hoffman</a>
</span>&nbsp;<span class=post-publish>published on <time datetime=2023-08-17>2023-08-17</time></span>&nbsp;<span class=post-category>included in </span>&nbsp;<span class=post-category>category <a href=/categories/python/><i class="far fa-folder fa-fw"></i>Python</a></span></div><div class=content>Background and MotivationI recently had a conversation with a few of my coworkers where I had mentioned that Python is a strongly typed language. One of them didn&rsquo;t think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my coworkers and I are experienced Python developers, none of us had a clear understanding of strong typing.</div><div class=post-footer><a href=/01-python-a-strongly-dynamically-duck-typed-interpreted-language/>Read more...</a><div class=post-tags><i class="fas fa-tags fa-fw"></i>&nbsp;<a href=/tags/python/>Python</a>,&nbsp;<a href=/tags/typing/>Typing</a>,&nbsp;<a href=/tags/programming-languages/>Programming Languages</a></div></div></article></div></div></main><footer class=footer><div class=footer-container><div class=footer-line>Powered by <a href=https://gohugo.io/ target=_blank rel="noopener noreferrer" title="Hugo 0.118.2">Hugo</a>&nbsp;|&nbsp;Theme - <a href=https://github.com/HEIGE-PCloud/DoIt target=_blank rel="noopener noreferrer" title="DoIt 0.4.0"><i class="far fa-edit fa-fw"></i> DoIt</a></div><div class=footer-line><span class=author itemprop=copyrightHolder>&nbsp;<a href=/ target=_blank rel="noopener noreferrer">Matthew Hoffman</a></span>&nbsp;|&nbsp;<span class=license><a rel="license external nofollow noopener noreffer" href=https://creativecommons.org/licenses/by-nc/4.0/ target=_blank>CC BY-NC 4.0</a></span></div><div class=footer-line></div><div class=footer-line></div></div></footer></div><div id=fixed-buttons><a href=#back-to-top id=back-to-top-button class=fixed-button title="Back to Top"><i class="fas fa-arrow-up fa-fw"></i>
</span>&nbsp;<span class=post-publish>published on <time datetime=2023-08-17>2023-08-17</time></span>&nbsp;<span class=post-category>included in </span>&nbsp;<span class=post-category>category <a href=/categories/python/><i class="far fa-folder fa-fw"></i>Python</a></span></div><div class=content>Background and MotivationI recently had a conversation with a few of my colleagues where I had mentioned that Python is a strongly typed language. One of them didn&rsquo;t think that it was, and another explained that strong typing means that every object has a type, which is true about Python but is not the definition of strong typing. It surprised me to realize that even though my colleagues and I are experienced Python developers, none of us had a clear understanding of strong typing.</div><div class=post-footer><a href=/01-python-a-strongly-dynamically-duck-typed-interpreted-language/>Read more...</a><div class=post-tags><i class="fas fa-tags fa-fw"></i>&nbsp;<a href=/tags/python/>Python</a>,&nbsp;<a href=/tags/typing/>Typing</a>,&nbsp;<a href=/tags/programming-languages/>Programming Languages</a></div></div></article></div></div></main><footer class=footer><div class=footer-container><div class=footer-line>Powered by <a href=https://gohugo.io/ target=_blank rel="noopener noreferrer" title="Hugo 0.118.2">Hugo</a>&nbsp;|&nbsp;Theme - <a href=https://github.com/HEIGE-PCloud/DoIt target=_blank rel="noopener noreferrer" title="DoIt 0.4.0"><i class="far fa-edit fa-fw"></i> DoIt</a></div><div class=footer-line><span class=author itemprop=copyrightHolder>&nbsp;<a href=/ target=_blank rel="noopener noreferrer">Matthew Hoffman</a></span>&nbsp;|&nbsp;<span class=license><a rel="license external nofollow noopener noreffer" href=https://creativecommons.org/licenses/by-nc/4.0/ target=_blank>CC BY-NC 4.0</a></span></div><div class=footer-line></div><div class=footer-line></div></div></footer></div><div id=fixed-buttons><a href=#back-to-top id=back-to-top-button class=fixed-button title="Back to Top"><i class="fas fa-arrow-up fa-fw"></i>
</a><a href=# id=view-comments class=fixed-button title="View Comments"><i class="fas fa-comment fa-fw"></i></a></div><div class=assets><script type=text/javascript>window.config={code:{copyTitle:"Copy to clipboard",maxShownLines:50},search:{algoliaAppID:"PASDMWALPK",algoliaIndex:"index.en",algoliaSearchKey:"b42948e51daaa93df92381c8e2ac0f93",highlightTag:"em",maxResultLength:10,noResultsFound:"No results found",snippetLength:30,type:"algolia"},sharerjs:!0}</script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/[email protected]/dist/clipboard.min.js></script><script type=text/javascript src=https://cdn.jsdelivr.net/npm/[email protected]/sharer.min.js></script><script type=text/javascript src=/js/theme.min.js defer></script></div></body></html>
Loading

0 comments on commit e09f6f1

Please sign in to comment.