On Sat, Apr 11, 2015 at 3:21 PM, Steven D'Aprano wrote:
> On Sun, Apr 12, 2015 at 05:09:43AM +1000, Steven D'Aprano wrote:
>
>> Almost correct, but not quite. range, like xrange in Python 2, is not a
>> generator, but a custom-made lazy sequence object.
>>
>> py> gen() # This actually is a genera
On Sun, Apr 12, 2015 at 05:09:43AM +1000, Steven D'Aprano wrote:
> Almost correct, but not quite. range, like xrange in Python 2, is not a
> generator, but a custom-made lazy sequence object.
>
> py> gen() # This actually is a generator.
>
> py> range(1, 10) # This is not.
> range(1, 10)
Oop
On 11/04/2015 20:02, Steven D'Aprano wrote:
On Sat, Apr 11, 2015 at 10:41:28AM -0700, Jim Mooney wrote:
Why does the first range convert to a list, but not the second?
p = list(range(1,20)), (range(40,59))
p
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
range(40, 59)
On Sat, Apr 11, 2015 at 02:15:49PM -0400, Joel Goldstick wrote:
> On Sat, Apr 11, 2015 at 1:41 PM, Jim Mooney wrote:
> > Why does the first range convert to a list, but not the second?
> >
> p = list(range(1,20)), (range(40,59))
> p
> > ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
On Sat, Apr 11, 2015 at 10:41:28AM -0700, Jim Mooney wrote:
> Why does the first range convert to a list, but not the second?
>
> >>> p = list(range(1,20)), (range(40,59))
> >>> p
> ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
> range(40, 59))
Why would the second conver
Op 11-04-15 om 19:41 schreef Jim Mooney:
Why does the first range convert to a list, but not the second?
p = list(range(1,20)), (range(40,59))
p
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
range(40, 59))
I'm not sure I understand correctly. This is what the top
On Sat, Apr 11, 2015 at 1:41 PM, Jim Mooney wrote:
> Why does the first range convert to a list, but not the second?
>
p = list(range(1,20)), (range(40,59))
p
> ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
> range(40, 59))
>
Assuming you are using python 3.x ran
Why does the first range convert to a list, but not the second?
>>> p = list(range(1,20)), (range(40,59))
>>> p
([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
range(40, 59))
--
Jim
"Stop, Harold! That bagel has radishes!"
"Thank God, Mary - you've saved me again!"
__