



<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: An Object-Oriented Primer in Python: Part 2</title>
	<atom:link href="http://blog.tsmacdonald.com/archives/238/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.tsmacdonald.com/archives/238</link>
	<description></description>
	<lastBuildDate>Thu, 09 Feb 2012 05:34:05 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Can+~</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-600</link>
		<dc:creator>Can+~</dc:creator>
		<pubDate>Wed, 30 Sep 2009 01:43:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-600</guid>
		<description>&quot;print “It’s a %s”%self.breed
the # %s”% #
what does it mean?&quot;

That&#039;s the C-style formatted printing, it&#039;s usually more compact and easier to read when you are working with long texts, or multiple variables, because you can pack everything inside a tuple and just throw it over a syntax, rathern than having to concatenate every variable.

&quot;Hello %s, in %d days you need to %s&quot; % (&quot;John&quot;, 10, &quot;Take out the trash&quot;)

Pair that with Dictionaries:

&quot;Hello %(name)s, in %(days)d days you need to %(task)s&quot; % {&quot;name&quot;:&quot;John&quot;, &quot;days&quot;:3, &quot;task&quot;:&quot;Take out the trash&quot;}</description>
		<content:encoded><![CDATA[<p>&#8220;print “It’s a %s”%self.breed<br />
the # %s”% #<br />
what does it mean?&#8221;</p>
<p>That&#8217;s the C-style formatted printing, it&#8217;s usually more compact and easier to read when you are working with long texts, or multiple variables, because you can pack everything inside a tuple and just throw it over a syntax, rathern than having to concatenate every variable.</p>
<p>&#8220;Hello %s, in %d days you need to %s&#8221; % (&#8220;John&#8221;, 10, &#8220;Take out the trash&#8221;)</p>
<p>Pair that with Dictionaries:</p>
<p>&#8220;Hello %(name)s, in %(days)d days you need to %(task)s&#8221; % {&#8220;name&#8221;:&#8221;John&#8221;, &#8220;days&#8221;:3, &#8220;task&#8221;:&#8221;Take out the trash&#8221;}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timmy</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-376</link>
		<dc:creator>Timmy</dc:creator>
		<pubDate>Mon, 20 Jul 2009 18:13:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-376</guid>
		<description>hey.breed is merely an attribute of hey--it&#039;s just the name of a variable that contains a string. To show it, you would have to print it:
print hey.breed</description>
		<content:encoded><![CDATA[<p>hey.breed is merely an attribute of hey&#8211;it&#8217;s just the name of a variable that contains a string. To show it, you would have to print it:<br />
print hey.breed</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giorgio</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-370</link>
		<dc:creator>giorgio</dc:creator>
		<pubDate>Sat, 18 Jul 2009 11:45:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-370</guid>
		<description>class Dog:
    def __init__(self,breed):
        self.breed = breed
    def showBreed(self):
        print &quot;It is a %s&quot;%self.breed
    def changeBreed(self,breed):
        self.breed = breed
hey = Dog(&quot;Golden&quot;)
hey.showBreed()
hey.breed = &quot;LeLe&quot;
hey.showBreed()
hey.changeBreed(&quot;LALA&quot;)
hey.showBreed()
hey.breed



this is my code.
why at the end...the last &quot;hey.breed&quot;...never come out anything?</description>
		<content:encoded><![CDATA[<p>class Dog:<br />
    def __init__(self,breed):<br />
        self.breed = breed<br />
    def showBreed(self):<br />
        print &#8220;It is a %s&#8221;%self.breed<br />
    def changeBreed(self,breed):<br />
        self.breed = breed<br />
hey = Dog(&#8220;Golden&#8221;)<br />
hey.showBreed()<br />
hey.breed = &#8220;LeLe&#8221;<br />
hey.showBreed()<br />
hey.changeBreed(&#8220;LALA&#8221;)<br />
hey.showBreed()<br />
hey.breed</p>
<p>this is my code.<br />
why at the end&#8230;the last &#8220;hey.breed&#8221;&#8230;never come out anything?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: giorgio</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-369</link>
		<dc:creator>giorgio</dc:creator>
		<pubDate>Sat, 18 Jul 2009 10:14:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-369</guid>
		<description>print &quot;It&#039;s a %s&quot;%self.breed
the #   %s&quot;%    #
what does it mean?
why dont we use print &quot; It&#039;s a &quot; + str(self.breed)??</description>
		<content:encoded><![CDATA[<p>print &#8220;It&#8217;s a %s&#8221;%self.breed<br />
the #   %s&#8221;%    #<br />
what does it mean?<br />
why dont we use print &#8221; It&#8217;s a &#8221; + str(self.breed)??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Timmy</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-188</link>
		<dc:creator>Timmy</dc:creator>
		<pubDate>Thu, 02 Apr 2009 11:18:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-188</guid>
		<description>@Rigo Yes, self.foo is an attribute.
If you do this:
class Whatever(parameter):
It&#039;ll think that Whatever inherits from parameter.</description>
		<content:encoded><![CDATA[<p>@Rigo Yes, self.foo is an attribute.<br />
If you do this:<br />
class Whatever(parameter):<br />
It&#8217;ll think that Whatever inherits from parameter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rigo Vides</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-187</link>
		<dc:creator>Rigo Vides</dc:creator>
		<pubDate>Thu, 02 Apr 2009 06:27:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-187</guid>
		<description>@Bob, it&#039;s similar to &#039;this&#039; in Java...

I didn&#039;t understand why the atributes aren&#039;t defined within the class&#039;s code block... They&#039;re only declared as parameters in the class methods. Does this means that once we assign a value with self.foo operator, this foo variable becomes an atribute for the class?</description>
		<content:encoded><![CDATA[<p>@Bob, it&#8217;s similar to &#8216;this&#8217; in Java&#8230;</p>
<p>I didn&#8217;t understand why the atributes aren&#8217;t defined within the class&#8217;s code block&#8230; They&#8217;re only declared as parameters in the class methods. Does this means that once we assign a value with self.foo operator, this foo variable becomes an atribute for the class?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bob</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-100</link>
		<dc:creator>Bob</dc:creator>
		<pubDate>Mon, 09 Mar 2009 10:03:28 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-100</guid>
		<description>I had no idea that that is what the self parameter was for. Thanks ;)</description>
		<content:encoded><![CDATA[<p>I had no idea that that is what the self parameter was for. Thanks <img src='http://blog.tsmacdonald.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: An Object-Oriented Primer in Python: Part 1</title>
		<link>http://blog.tsmacdonald.com/archives/238/comment-page-1#comment-89</link>
		<dc:creator>An Object-Oriented Primer in Python: Part 1</dc:creator>
		<pubDate>Sat, 21 Feb 2009 02:01:24 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tsmacdonald.com/?p=238#comment-89</guid>
		<description>[...] Part 2 to learn how to make classes~   Hello there! If you are new here, you might want to subscribe to [...]</description>
		<content:encoded><![CDATA[<p>[...] Part 2 to learn how to make classes~   Hello there! If you are new here, you might want to subscribe to [...]</p>
]]></content:encoded>
	</item>
</channel>
</rss>

