<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ventolin Mexico - FDA Approved Pharmacy</title>
	<atom:link href="http://noehr.org/tag/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://noehr.org</link>
	<description>Pythonista, RESTafarian, Binary Poet &#38; Proud Bucketeer</description>
	<lastBuildDate>Thu, 01 Oct 2009 10:57:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ventolin Mexico - FDA Approved Pharmacy</title>
		<link>http://noehr.org/2009/03/08/lrstrip-considered-harmful/</link>
		<comments>http://noehr.org/2009/03/08/lrstrip-considered-harmful/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 11:57:14 +0000</pubDate>
		<dc:creator>jespern</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://noehr.org/?p=28</guid>
		<description><![CDATA[ Ventolin mexico, If you're using lstrip() or rstrip() in your code, chances are you might have a problem.
This is because those functions probably don't do what you think they do.
So go ack --python '[lr]strip' your codebase now.
What you think it does
If you haven't been bitten by this before, ventolin hfa compared to proventil proair, [...]]]></description>
			<content:encoded><![CDATA[<p> <b>Ventolin mexico</b>, If you're using lstrip() or rstrip() in your code, chances are you might have a problem.</p>
<p>This is because those functions probably <em>don't do what you think they do.</em></p>
<p>So go <code><a href="http://betterthangrep.com/">ack</a> --python '[lr]strip'</code> your codebase now.</p>
<p><h3>What you think it does</h3></p>
<p>If you haven't been bitten by this before, <b>ventolin hfa compared to proventil proair</b>, and you haven't thoroughly read <code>help(str.rstrip)</code>, <b>Ventolin inhailer generic</b>, you probably think rstrip will strip a sequence of bytes off the end of a string.</p>
<p>For example, it could be used to get rid of a file extension, <b>ventolin uk</b>, like</p>
<p><code><br />
>>> filename = "fumble.exe"<br />
>>> basefn = filename.rstrip(".exe")<br />
</code></p>
<p>Bzzzt.  <b>Ventolin dosages</b>, Wrong.</p>
<p><h3>What it actually does</h3></p>
<p>As per the docstring:</p>
<p><blockquote><br />
rstrip(...)<br />
    S.rstrip([chars]) -> string or unicode</p>
<p>    Return a copy of the string S with trailing whitespace removed, <b>ventolin mexico</b>.<br />
    If chars is given and not None, remove characters in chars instead, <b>ventolin inhaler coupons</b>.<br />
    If chars is unicode, <b>Relion ventolin inhaler</b>, S will be converted to unicode before stripping<br />
</blockquote></p>
<p>Pay attention here: character<strong>S</strong>. Plural. Not a sequence, <b>ventolin hfa inhalers</b>.  <b>Ventolin mexico</b>, More like a list.</p>
<p>Now, <b>Trade name for the drug ventolin</b>, have a look at our previous example, removing the extension.</p>
<p><code><br />
>>> filename = "fumble.exe"<br />
>>> basefn = filename.rstrip(".exe")<br />
>>> basefn<br />
'fumbl'<br />
</code></p>
<p>Not what you expected, <b>aphex twin ventolin video edit audio</b>, eh.  <b>Buy ventolin</b>, Problem here is that it treats '.exe' as a list of characters, so it's basically this:</p>
<p><code><br />
>>> remove_chars = [ '.', 'e', <b>adrenaline vs ventolin</b>, 'x', <b>Ventolin is used for</b>, 'e' ]<br />
>>> for char in reverse(filename):<br />
... 	if char in remove_chars:<br />
... 		# remove the char we're looking at<br />
.., <b>ventolin mexico</b>. 	else:<br />
.., <b>ventolin hfa inhaler</b>. 		break<br />
</code></p>
<p><ol><br />
  <li>Start at the end and go backwards, <b>Ventolin contains ethanol</b>, byte by byte.</li><br />
  <li>If the character we're seeing is in the aforementioned list, remove it.</li><br />
  <li>If not, we've reached a stop point, <b>drugs ventolin</b>, so process no further.</li><br />
</ol></p>
<p>The opposite is of course true for <strong>l</strong>strip.  <b>Isordil ventolin information</b>, <h3>What it is useful for</h3></p>
<p>Once you get over the misleading behavior and come to terms with what it <em>actually</em> does, you can start discovering what it <em>is</em> useful for.</p>
<p>For example, <b>ventolin nebulizer solution</b>, it's immensely useful for stripping leading or trailing whitespace.  <b>Ventolin mexico</b>, In fact, this is such a common use-case that this is what it does if you don't specify any arguments.  <b>Use ventolin with spacer</b>, Since it's a <em>list</em> of characters, in cases where you need to remove  both unix-style carriage returns as well as win32 ones, you can simply do:</p>
<p><code><br />
block_of_text.rstrip("\r\n")<br />
</code></p>
<p>This will remove both, <b>ventolin hfc</b>. They don't necessarily have to be in that order.  <b>Buy ventolin in central london</b>, <h3>What you probably wanted instead</h3></p>
<p>OK, so having that out of the way, what <em>would</em> you want to get rid of a file extension, <b>ventolin syrup otc or rx</b>. <code>replace()</code>.  <b>Relion ventolin fha</b>, replace() is perfect for this, because it takes a third optional argument:</p>
<p><blockquote><br />
replace(...)<br />
    S.replace (old, new[, <b>buy ventolin no prescription</b>, count]) -> string</p>
<p>    Return a copy of string S with all occurrences of substring<br />
    old replaced by new.  <b>Ventolin nebulizer</b>, If the optional argument count is<br />
    given, only the first count occurrences are replaced.<br />
</blockquote></p>
<p>So lets try it again:</p>
<p><code><br />
>>> filename = "fumble.exe"<br />
>>> basefn = filename.replace(".exe", <b>ventolin hfa mechanical ventilator</b>, "", 1)<br />
>>> basefn<br />
'fumble'<br />
</code></p>
<p>Much better.</p>
<p></p>
<p><b>Similar posts:</b> <a href='http://noehr.org/?p=59'>Online ventolin pharmacy</a>. <a href='http://noehr.org/?p=25'>Albuterol proventil ventolin</a>. <a href='http://noehr.org/?p=52'>Ventolin online</a>. <a href='http://noehr.org/?p=50'>Ventolin hfa without a prescription</a>.<br />
<b>Trackbacks from:</b> <a href='http://ksbj.org/gma/?p=80'>Ventolin mexico</a>. <a href='http://bigwheelmagazine.com/?p=15458'>Ventolin mexico</a>. <a href='http://ksbj.org/eblogs/wp263/morningshow/?p=2898'>Ventolin</a>. <a href='http://gorditalinda.com/?p=79'>Salbutamol ventolin side effects</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://noehr.org/2009/03/08/lrstrip-considered-harmful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
