<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.openstack.org/w/index.php?action=history&amp;feed=atom&amp;title=CodingStandards%2FKeywordArguments</id>
		<title>CodingStandards/KeywordArguments - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.openstack.org/w/index.php?action=history&amp;feed=atom&amp;title=CodingStandards%2FKeywordArguments"/>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=CodingStandards/KeywordArguments&amp;action=history"/>
		<updated>2026-07-08T18:41:59Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=CodingStandards/KeywordArguments&amp;diff=17596&amp;oldid=prev</id>
		<title>Ryan Lane: Text replace - &quot;__NOTOC__&quot; to &quot;&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=CodingStandards/KeywordArguments&amp;diff=17596&amp;oldid=prev"/>
				<updated>2013-02-17T23:30:52Z</updated>
		
		<summary type="html">&lt;p&gt;Text replace - &amp;quot;__NOTOC__&amp;quot; to &amp;quot;&amp;quot;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;col class='diff-marker' /&gt;
				&lt;col class='diff-content' /&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='2' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 23:30, 17 February 2013&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-l1&quot; &gt;Line 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; 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 class=&quot;diffchange diffchange-inline&quot;&gt;__NOTOC__&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; 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;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki caution&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki caution&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ryan Lane</name></author>	</entry>

	<entry>
		<id>https://wiki.openstack.org/w/index.php?title=CodingStandards/KeywordArguments&amp;diff=3377&amp;oldid=prev</id>
		<title>Brian at 20:05, 1 February 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.openstack.org/w/index.php?title=CodingStandards/KeywordArguments&amp;diff=3377&amp;oldid=prev"/>
				<updated>2011-02-01T20:05:46Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!wiki caution&lt;br /&gt;
'''This is a coding standard ''suggestion''.'''&lt;br /&gt;
&lt;br /&gt;
Relevant blueprint: https://blueprints.launchpad.net/nova&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Certain more nuanced aspects of programming in Python are not covered by PEP-0008. One of those nuances is the use of a keyword arguments helper when confronted with a large number of potential inputs to a function.&lt;br /&gt;
&lt;br /&gt;
For example, a very important and key aspect of creating a virtual server:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!highlight python&lt;br /&gt;
def create(self, context, instance_type,&lt;br /&gt;
           image_id, kernel_id=None, ramdisk_id=None,&lt;br /&gt;
           min_count=1, max_count=1,&lt;br /&gt;
           display_name='', display_description='',&lt;br /&gt;
           key_name=None, key_data=None, security_group='default',&lt;br /&gt;
           availability_zone=None, user_data=None):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;Create the number of instances requested if quota and&lt;br /&gt;
    other arguments check out ok.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Might be rewritten as:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!highlight python&lt;br /&gt;
def create(self, context, instance_type, image_id, **kwargs):&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    Attempt to create one or more virtual machine instances using the&lt;br /&gt;
    given context, instance_type, image_id, and a list of parameter which&lt;br /&gt;
    are passed in as keyword arguments. &lt;br /&gt;
&lt;br /&gt;
    `quota.QuotaError` will be raised by this function if the minimum number&lt;br /&gt;
    of instances cannot be created due to quota violations.&lt;br /&gt;
&lt;br /&gt;
    @param context: `nova.context.RequestContext` compatible object&lt;br /&gt;
    @param instance_type: string identifying the instance type&lt;br /&gt;
    @param image_id: integer identifying the image to use&lt;br /&gt;
    @kwarg kernel_id: integer identifying the kernel to use&lt;br /&gt;
    @kwarg ramdisk_id: integer identifying the ramdisk to use&lt;br /&gt;
    @kwarg min_count: minimum instances to create, defaults to 1&lt;br /&gt;
    @kwarg max_count: maximum instances to create, defaults to 1&lt;br /&gt;
    @kwarg display_name: string name to give created instances&lt;br /&gt;
    @kwarg display_description: string description to give instances&lt;br /&gt;
    @kwarg key_name: string name of key pair to use&lt;br /&gt;
    @kwarg key_data: public key to use for created instances&lt;br /&gt;
    @kwarg security_group: list or string containing names of groups&lt;br /&gt;
    @kwarg availability_zone: string identifying availability zone&lt;br /&gt;
    @kwarg user_data: string of data to attach to created instances&lt;br /&gt;
    &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
    kernel_id = kwargs.get(&amp;quot;kernel_id&amp;quot;, None)&lt;br /&gt;
    ramdisk_id = kwargs.get(&amp;quot;ramdisk_id&amp;quot;, None)&lt;br /&gt;
    min_count = kwargs.get(&amp;quot;min_count&amp;quot;, 1)&lt;br /&gt;
    max_count = kwargs.get(&amp;quot;max_count&amp;quot;, 1)&lt;br /&gt;
    display_name = kwargs.get(&amp;quot;display_name&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    display_description = kwargs.get(&amp;quot;display_description&amp;quot;, &amp;quot;&amp;quot;)&lt;br /&gt;
    key_name = kwargs.get(&amp;quot;key_name&amp;quot;, None)&lt;br /&gt;
    security_group = kwargs.get(&amp;quot;security_group&amp;quot;, &amp;quot;default&amp;quot;)&lt;br /&gt;
    availability_zone = kwargs.get(&amp;quot;availability_zone&amp;quot;, None)&lt;br /&gt;
    user_data = kwargs.get(&amp;quot;user_data&amp;quot;, None)&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Why might we want to replace existing code (which works) with code which is ''over 4 times'' as long?'''&lt;br /&gt;
&lt;br /&gt;
# Currently programs like ''pydoc'' are throughly unhelpful when functions such as this one are encountered.&lt;br /&gt;
# Function definitions which might have an arbitrary number of keyword parameters can still be made to fit on a smaller number of lines.&lt;br /&gt;
# Moving to the new form would allow more fined grained configuration for default values:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!highlight python&lt;br /&gt;
 kernel_id = kwargs.get(&amp;quot;kernel_id&amp;quot;, None)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ...might become...&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;#!highlight python&lt;br /&gt;
 kernel_id = kwargs.get(&amp;quot;kernel_id&amp;quot;, config.default_kernel_id)&lt;br /&gt;
 &amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Brian</name></author>	</entry>

	</feed>