On 10/28/06, Christoph Zwerschke <[EMAIL PROTECTED]> wrote:
>
> Michael Steinfeld wrote:
> > so if I was to do something like
> >
> > import calendar, itertools
> >
> > month = calendar.monthcalendar(2006, 10)
> > days = [i for i in itertools.chain(*month)]
>
> You don't need to build a list here; simply pass the iterator.
>
and if you were to build a flattened list from an iterator of
iterators, the sane way would be much different..
month = calendar.monthcalendar(2006, 10)
days = [day for week in month for day in week]
or imperatively:
month = calendar.monthcalendar(2006, 10)
days = []
for week in month:
days.extend(week)
-bob
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---