About python while statement and pop()

Chris Angelico rosuav at gmail.com
Thu Jun 12 12:57:05 EDT 2014


On Fri, Jun 13, 2014 at 2:49 AM, Mark H Harris <harrismh777 at gmail.com> wrote:
> Consider this generator variation:
>>>>> def poplist(L):
> done = False
> while done==False:
>> yield L[::-1][:1:]
> L = L[::-1][1::][::-1]
> if len(L)==0: done=True

Why not just "while L"? Or are you deliberately trying to ensure that
cheating will be detectable?
ChrisA


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /