USerDefinehz1.shxx

化之前必须设计好数字化所采用的技术路线,它不仅直接关系到地图数字化的效率,而且..
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
实习一:空间信息的数字化采集与处理
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口ObjectArx培训_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
文档贡献者贡献于
评价文档:
64页免费164页2下载券120页1下载券294页1下载券38页2下载券 4页免费1页免费6页免费135页4下载券294页1下载券
ObjectArx培训|
把文档贴到Blog、BBS或个人站等:
普通尺寸(450*500pix)
较大尺寸(630*500pix)
大小:229.50KB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢userdefine1.shx是什么字体
userdefine1.shx是什么字体
不区分大小写匿名
网上查询。。
CAD字体文件
等待您来回答
软件领域专家Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.
As a complete Python newbie, it certainly looks that way. Running the
following...
x = enumerate(['fee', 'fie', 'foe'])
# Out[1]: (0, 'fee')
# Out[2]: [(1, 'fie'), (2, 'foe')]
# Out[3]: []
... I notice that: (a) x does have a next method, as seems to be
required for generators, and (b) x can only be iterated over once, a
characteristic of generators emphasized in .
On the other hand, the two most highly-upvoted answers to
about how to determine whether an object is a generator would seem to
indicate that enumerate() does not return a generator.
import types
import inspect
x = enumerate(['fee', 'fie', 'foe'])
isinstance(x, types.GeneratorType)
# Out[4]: False
inspect.isgenerator(x)
# Out[5]: False
... while a third
to that question would seem to indicate that enumerate() does in fact return a generator:
def isgenerator(iterable):
return hasattr(iterable,'__iter__') and not hasattr(iterable,'__len__')
isgenerator(x)
# Out[8]: True
So what's going on? Is x a generator or not? Is it in some sense
"generator-like", but not an actual generator? Does Python's use of
duck-typing mean that the test outlined in the final code block above
is actually the best one?
Rather than continue to write down the possibilities running through my
head, I'll just throw this out to those of you who will immediately
know the answer.
71k3104185
While the Python documentation says that enumerate is functionally equivalent to:
def enumerate(sequence, start=0):
for elem in sequence:
yield n, elem
The real enumerate function returns an iterator, but not an actual generator. You can see this if you call help(x) after doing creating an enumerate object:
&&& x = enumerate([1,2])
&&& help(x)
class enumerate(object)
enumerate(iterable[, start]) -& iterator for index, value of iterable
Return an enumerate object.
iterable must be another object that supports
iteration.
The enumerate object yields pairs containing a count (from
start, which defaults to zero) and a value yielded by the iterable argument.
enumerate is useful for obtaining an indexed list:
(0, seq[0]), (1, seq[1]), (2, seq[2]), ...
Methods defined here:
__getattribute__(...)
x.__getattribute__('name') &==& x.name
__iter__(...)
x.__iter__() &==& iter(x)
x.next() -& the next value, or raise StopIteration
----------------------------------------------------------------------
Data and other attributes defined here:
__new__ = &built-in method __new__ of type object&
T.__new__(S, ...) -& a new object with type S, a subtype of T
In Python, generators are basically a specific type of iterator that's implemented by using a yield to return data from a function. However, enumerate is actually implemented in C, not pure Python, so there's no yield involved. You can find the source here:
Testing for enumerate types:
I would include this important test in an exploration of the enumerate type and how it fits into the Python language:
&&& import collections
&&& e = enumerate('abc')
&&& isinstance(e, enumerate)
&&& isinstance(e, collections.Iterable)
&&& isinstance(e, collections.Iterator)
But we see that:
&&& import types
&&& isinstance(e, types.GeneratorType)
So we know that enumerate objects are not generators.
The Source:
we can see that the enumerate object () that iteratively returns , and in the
The Standard Library Test
So the Abstract Base Class library uses the following test:
&&& hasattr(e, 'next') and hasattr(e, '__iter__')
So we know that enumerate types are iterators.
. So generators are iterators, because they have the next and __iter__ methods, but not all iterators are necessarily generators, as we've seen with this enumerate object.
So what do we know about enumerate?
From the docs and the source, we know that enumerate returns an enumerate object, and we know by definition that it is an iterator, even if our testing states that it is explicitly not a generator.
We also know from the documentation that generator types simply "" Therefore, generators are a subset of iterators. Furthermore, this allows us to derive the following generalization:
All generators are iterators, but not all iterators are generators.
So while we can make our enumerate object into a generator:
&&& g = (i for i in e)
&&& isinstance(g, types.GeneratorType)
We can't expect that it is a generator itself, so this would be the wrong test.
So What to Test?
And what this means is that you should not be testing for a generator, and you should probably use the first of the tests I provided, and not reimplement the Standard Library (which I hope I can be excused from doing today.):
If you require an enumerate type, you'll probably want to allow for iterables or iterators of tuples with integer indexes, and the following will return True:
isinstance(g, collections.Iterable)
If you only want specifically an enumerate type:
isinstance(e, enumerate)
PS In case you're interested, here's the source implementation of generators:
10.3k112949
Is it in some sense "generator-like", but not an actual generator?
Yes, it is.
You shouldn't really care if it is a duck, but only if it walks, talks, and smells like one.
It just as well be a generator, shouldn't make a real difference.
It is typical to have generator-like types instead of actual generators, when you want to extend the functionality. E.g. range is also generator-like, but it also supports things like y in range(x) and len(range(x)) (xrange in python2.x).
16.2k21951
You can try a few things out to prove to yourself that it's neither a generator nor a subclass of a generator:
&&& x = enumerate(["a","b","c"])
&&& type(x)
&type 'enumerate'&
&&& import types
&&& issubclass(type(x), types.GeneratorType)
As Daniel points out, it is its own type, enumerate. That type happens to be iterable. Generators are also iterable. That second, down-voted answer you reference basically just points that out somewhat indirectly by talking about the __iter__ method.
So they implement some of the same methods by virtue of both being iterable. Just like lists and generators are both iterable, but are not the same thing.
So rather than say that something of type enumerate is "generator-like", it makes more sense to simply say that both the enumerate and GeneratorType classes are iterable (along with lists, etc.). How they iterate over data (and shape of the data they store) might be quite different, but the interface is the same.
Hope that helps!
enumerate generates an enumerate-object. It is a iterator, like a generator.
Your Answer
Sign up or
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
Post as a guest
required, but not shown
Post as a guest
required, but not shown
By posting your answer, you agree to the
Not the answer you're looking for?
Browse other questions tagged
Stack Overflow works best with JavaScript enabled}

我要回帖

更多关于 hz1.shx 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信