<?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>expcetion Archives - Huahua&#039;s Tech Road</title>
	<atom:link href="https://zxi.mytechroad.com/blog/tag/expcetion/feed/" rel="self" type="application/rss+xml" />
	<link>https://zxi.mytechroad.com/blog/tag/expcetion/</link>
	<description></description>
	<lastBuildDate>Tue, 30 Jun 2020 01:04:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.0.8</generator>

<image>
	<url>https://zxi.mytechroad.com/blog/wp-content/uploads/2017/09/cropped-photo-32x32.jpg</url>
	<title>expcetion Archives - Huahua&#039;s Tech Road</title>
	<link>https://zxi.mytechroad.com/blog/tag/expcetion/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Iterables in Python</title>
		<link>https://zxi.mytechroad.com/blog/python/iterables-in-python/</link>
					<comments>https://zxi.mytechroad.com/blog/python/iterables-in-python/#respond</comments>
		
		<dc:creator><![CDATA[zxi]]></dc:creator>
		<pubDate>Tue, 30 Jun 2020 01:04:13 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[expcetion]]></category>
		<category><![CDATA[iterables]]></category>
		<category><![CDATA[iterator]]></category>
		<category><![CDATA[python]]></category>
		<guid isPermaLink="false">https://zxi.mytechroad.com/blog/?p=7018</guid>

					<description><![CDATA[<p>Example Code: [crayon-663a0d83c7ef5457714727/]</p>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/python/iterables-in-python/">Iterables in Python</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="可迭代的 Iterables - Python Weekly EP4" width="500" height="281" src="https://www.youtube.com/embed/-PklUOOz4n8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div></figure>



<h2><strong>Example Code:</strong></h2>



<div class="responsive-tabs">
<h2 class="tabtitle">Iterables in Python</h2>
<div class="tabcontent">

<pre class="crayon-plain-tag"># Author: Huahua
class MyListIterator:
  def __init__(self, my_list, index=0):
    self.my_list = my_list
    self.index = index

  def __next__(self):
    if self.index &lt; len(self.my_list.data):
      val = self.my_list.data[self.index]
      self.index += 1
      return val
    else:
      raise StopIteration()

  def __iter__(self):
    return MyListIterator(self.my_list, self.index)
    # return self

class MyList:
  def __init__(self, data):
    self.data = list(data)

  def __getitem__(self, index):
    return self.data[index]

  def __len__(self):
    return len(self.data)

  def __iter__(self):
    return MyListIterator(self)

my_list = MyList([1,2,3,4,5])
it = iter(my_list)
next(it)
it2 = iter(it)
next(it)
print('--- it ---')
for x in it:
  print(x) # 3, 4, 5
print('--- it2 ---')
for x in it2:
  print(x) # 2, 3, 4, 5</pre>
</div></div>
<p>The post <a rel="nofollow" href="https://zxi.mytechroad.com/blog/python/iterables-in-python/">Iterables in Python</a> appeared first on <a rel="nofollow" href="https://zxi.mytechroad.com/blog">Huahua&#039;s Tech Road</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://zxi.mytechroad.com/blog/python/iterables-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
