[Tutor] when is a generator "smart?"
David
bouncingcats at gmail.com
Sun Jun 2 07:33:42 CEST 2013
On 02/06/2013, Jim Mooney <cybervigilante at gmail.com> wrote:
> On 1 June 2013 21:20, Steven D'Aprano <steve at pearwood.info> wrote:
>> On 02/06/13 13:58, Jim Mooney wrote:
>>>
>>> It's a little unclear to me where generators are more efficient.
>>
>>
>> When there are a lot of items, and you access the items one at a time,
>> not
>> all at once. If there are only a few items, a list or tuple has less
>> overhead and is easier to use.
>
> So how does one access a generator one element at a time?
google: python generator example
More information about the Tutor
mailing list