вівторок, 22 липня 2008 р.

Another lambda for lambda-lovers:

max_ = lambda seq, a=None, b=None: (lambda x, y: x if x > y else y)(a, b) if len(seq) == 0 else max_(seq[1:], (lambda x, y: x if x > y else y)(a, b), seq[0])

вівторок, 15 липня 2008 р.

Let's say you have a task: "divide string that consists of 12 chars into string of pairs delimited by ':' char". Well, a good way you can find by yourself, but here is The Evil Way:

>>> from itertools import izip
>>> splitjoin = lambda s, delimiter, size: delimiter.join(''.join(x) for x in (lambda seq, length: izip(*(iter(seq), ) * length))(s, size))
>>> splitjoin("abcdefghijkl", ':', 2)
'ab:cd:ef:gh:ij:kl'

Now I should find a place in the code to put this snippet in. :)

середа, 2 липня 2008 р.

Date of final release of Python 3.0/2.6 is moved to the 1st of October, while the previous planned date was 3rd of September. For those of you interested in reasons of this move, here are two quotes from GvR from python-dev thread on next beta of python:

"""On Tue, Jul 1, 2008 at 1:16 PM, Barry Warsaw <barry@python.org> wrote:
>
>Wow, I bet this one crept up on you as quickly as it did me!
>
>We have our second planned beta releases for 2.6 and 3.0 tomorrow. As usual I will start
>looking at blockers and buildbots tomorrow afternoon (UTC-4 time) with a plan to start building
>things at about 6pm. Also, I will of course be in #python-dev on freenode to answer any
>questions, or get second opinions.

>

>PEP 361 claims that these will be the last betas. Whether that's true or not depends on how
>well the beta2's go. Please help review code or fix bugs. If you know of things that absolutely
>must go into beta2, be sure there is an open release-blocker bug on the issue.

>

>Thanks,

>- -Barry



I think we should put this one off. The previous betas were done on June 18, and IMO the next beta should be about a month afterwards, not 2 weeks."""



"""On Tue, Jul 1, 2008 at 3:55 PM, Barry Warsaw <
barry@python.org> wrote:
> On Jul 1, 2008, at 4:54 PM, Guido van Rossum wrote:
>> On Tue, Jul 1, 2008 at 1:51 PM, Raymond Hettinger <python@rcn.com> wrote:
>> From: "Barry Warsaw" <barry@python.org>
>>
>> There are two options. I could shift everything forward 2 weeks and do
>> the next betas on July 16th. Or we could wait until August 6th. That
>> would mean 6 weeks between betas. It's fine with me either way.
>>
>> +1 for six weeks to allow the code to be more thoroughly exercised.
>>
>> In that case I'd rather insert an extra beta -- one in 2 weeks and one in
>> 6 weeks.
>
> Okay. I can't actually do it on July 16th, so the revised schedule will be:
>
> 15-Jul-2008 beta 2
> 23-Aug-2008 beta 3
> 03-Sep-2008 rc1
> 17-Sep-2008 rc2
> 01-Oct-2008 final releases
>
> I will update PEP 361 now.

+1

Thanks for being flexible!"""