# coding=utf8
from collections import Iterator
from collections import Iterable #迭代器对象
class OwnIteror( Iterator ):
def __init__(self , arrs ):
self.index = 0
self.arrs = arrs
def next(self):
if self.index > len( self.arrs ) - 1:
raise StopIteration
else:
self.index +=1
return self.arrs[ self.index - 1 ] #可迭代对象
class OwnIterable( Iterable ):
def __init__(self , arrs ):
self.arrs = arrs
def __iter__(self):
return OwnIteror( self.arrs ) for item in OwnIterable( [ 1,2,3,4,4,6 ] ):
print item

最新文章

  1. java关键字之final
  2. 岁末年初3Q大战惊现高潮,360震撼推出Android "3Q" IM即时通讯
  3. as3 同屏1000+动画,不掉帧。解决方案。
  4. (*p)++和*(p++)和*p++的区别
  5. 获取真实ip的报告
  6. UserDefault 用户首选项读写 swift
  7. 【Search a 2D Matrix】cpp
  8. SQL Server 127个SQL server热门资料汇总
  9. 什么是马甲APP?怎么用马甲APP导流
  10. python运维开发之第十一天(RabbitMQ,redis)
  11. Push Notification总结系列(一)
  12. iReport使用教程
  13. 将Asp.Net Core和corefx移植到.Net 4.0
  14. php session序列化攻击面浅析
  15. JDK8到JDK12各个版本的重要特性整理
  16. You have new mail in /var/spool/mail/root消除提示的方法
  17. const引用和函数占位参数遇上默认参数以及内联函数
  18. Method not found: 'System.Data.Entity.ModelConfiguration.Configuration.XXX
  19. Spark SQL初始化和创建DataFrame的几种方式
  20. HDU 2106 母猪的故事

热门文章

  1. git@github.com出现Permission denied (publickey)
  2. Reference与ReferenceQueue
  3. Python---基础---dict和set
  4. django 多条数据显示的坑(怪自己)
  5. RMQ Fanout
  6. Fckeditor实现WORD粘贴图片自动上传
  7. luogu P1020 导弹拦截 x
  8. 【HDOJ6628】permutation 1(dfs)
  9. 李满春与WebGIS
  10. SLF4J: The requested version 1.6 by your slf4j binding is not compatible with [1.5.5, 1.5.6]