<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.smithnet.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Python_Design</id>
	<title>Python Design - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.smithnet.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Python_Design"/>
	<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;action=history"/>
	<updated>2026-04-07T20:37:54Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=516&amp;oldid=prev</id>
		<title>NickPGSmith: 3 revisions imported</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=516&amp;oldid=prev"/>
		<updated>2024-05-08T04:53:41Z</updated>

		<summary type="html">&lt;p&gt;3 revisions imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 04:53, 8 May 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;4&quot; class=&quot;diff-notice&quot; lang=&quot;en-GB&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;!-- diff cache key wiki-wiki-:diff:1.41:old-515:rev-516 --&gt;
&lt;/table&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=515&amp;oldid=prev</id>
		<title>NickPGSmith: /* Protocols */</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=515&amp;oldid=prev"/>
		<updated>2023-12-16T13:23:43Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Protocols&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:23, 16 December 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Classes derived from Protcol define an interface with their attributes&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Classes derived from Protcol define an interface with their attributes&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Duck typing means another type of object that has at least the same attributes as the interface can be passed to it&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* Duck typing means another type of object that has at least the same attributes as the interface can be passed to it&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Alternative to subclassing&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki-wiki-:diff:1.41:old-514:rev-515:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=514&amp;oldid=prev</id>
		<title>NickPGSmith: /* Protocols */</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=514&amp;oldid=prev"/>
		<updated>2023-12-16T13:22:49Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Protocols&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en-GB&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:22, 16 December 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l28&quot;&gt;Line 28:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 28:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Protocols ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Protocols ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;?&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Classes derived from Protcol define an interface with their attributes&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;* Duck typing means another type of object that has at least the same attributes as the interface can be passed to it&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
	<entry>
		<id>https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=513&amp;oldid=prev</id>
		<title>NickPGSmith: Created page with &quot;== Functions ==  * Do one thing and do it well ** Should be at the same level of abstraction * Command-query separation: should either make some change or return data * Only request information it needs * Keep the number of paramters minimal ** An indication of how focused the function is * Don&#039;t create an use an object in the same place ** Use dependency injection * Don&#039;t use flag arguments ** can mean the funcrion should be two distinct functions to handle each case *...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.smithnet.org.uk/wiki/index.php?title=Python_Design&amp;diff=513&amp;oldid=prev"/>
		<updated>2023-12-16T12:37:49Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Functions ==  * Do one thing and do it well ** Should be at the same level of abstraction * Command-query separation: should either make some change or return data * Only request information it needs * Keep the number of paramters minimal ** An indication of how focused the function is * Don&amp;#039;t create an use an object in the same place ** Use dependency injection * Don&amp;#039;t use flag arguments ** can mean the funcrion should be two distinct functions to handle each case *...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Functions ==&lt;br /&gt;
&lt;br /&gt;
* Do one thing and do it well&lt;br /&gt;
** Should be at the same level of abstraction&lt;br /&gt;
* Command-query separation: should either make some change or return data&lt;br /&gt;
* Only request information it needs&lt;br /&gt;
* Keep the number of paramters minimal&lt;br /&gt;
** An indication of how focused the function is&lt;br /&gt;
* Don&amp;#039;t create an use an object in the same place&lt;br /&gt;
** Use dependency injection&lt;br /&gt;
* Don&amp;#039;t use flag arguments&lt;br /&gt;
** can mean the funcrion should be two distinct functions to handle each case&lt;br /&gt;
* Functions are objects, so can be passed around&lt;br /&gt;
&lt;br /&gt;
== Classes ==&lt;br /&gt;
&lt;br /&gt;
* Keep classes small&lt;br /&gt;
** Typically either data focused (structure) or behaviour focussed (methods)&lt;br /&gt;
* Make classes east to use as possible&lt;br /&gt;
** eg properties instead of methods&lt;br /&gt;
** use @property, @cached_property or @lru_cache&lt;br /&gt;
** __repr__ for developers, __str__ for users&lt;br /&gt;
* Use Dependency Injection&lt;br /&gt;
** Don&amp;#039;t create objects in the class, pass as arguments&lt;br /&gt;
* Make sure a class is really needed&lt;br /&gt;
** Classes are useful for multiple instances. If only one is needed, could be just a module function.&lt;br /&gt;
&lt;br /&gt;
== Protocols ==&lt;br /&gt;
&lt;br /&gt;
?&lt;/div&gt;</summary>
		<author><name>NickPGSmith</name></author>
	</entry>
</feed>