[Python-Dev] Half-baked proposal: * (and **?) in assignments (original) (raw)
Brett Cannon bac@OCF.Berkeley.EDU
Sun, 24 Nov 2002 01:40:45 -0800 (PST)
- Previous message: [Python-Dev] Half-baked proposal: * (and **?) in assignments
- Next message: [Python-Dev] Half-baked proposal: * (and **?) in assignments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Oren Tirosh]
I like this function, but the argument name is misleading - it isn't necessarily an iterator. In the common use cases it will be a list or tuple.
def peel(iterable, argcnt=2): iterator = iter(iterable) for num in xrange(argcnt): yield iterator.next() yield iterator The name 'iterable' is unambigous but a little awkward. I'd like to use the term 'sequence' but I'm afraid people already associate it with the built-in sequence types or with something indexable rather than iterable. Do you think of iterators as a sequences?
I know I think of them as a lazy sequence. But you are right, people tend to associate sequence with either lists or tuples, perhaps because you can do indexing on them.
-Brett
- Previous message: [Python-Dev] Half-baked proposal: * (and **?) in assignments
- Next message: [Python-Dev] Half-baked proposal: * (and **?) in assignments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]