From stuartw at mts.net  Thu Feb  1 22:57:01 2007
From: stuartw at mts.net (Stuart Williams)
Date: Thu, 1 Feb 2007 21:57:01 -0600
Subject: [Python Wpg] Last meeting, next meeting, and March tutorial idea
Message-ID: <17858.46733.502537.595690@gavel.swilliams.ca>

Despite the website wiki at http://winnipug.ca not always being
up-to-date, we are meeting regularly.  In January I presented some
ugly and beautiful code as discussed.  I'll post some next.

In February Scott is planning to present, as discussed in November, on
development with Glade, right Scott?  Feel free to give me a better
title, or correct me, or edit the wiki yourself.

We had some discussion about making the March meeting a 2-hour Python
primer or Introduction to Python session targeted at folks who are new
or potential future Python programmers.  Someone mentioned that April
might be too late in the year for this to work well.

With respect to who would do the tutorial, I'm willing to organize it
but would like some others to help.

We talked about the possibility of Syd having his Django (right?) 
presentation, originally scheduled for March but moved to April, ready
hiding up his sleeve at the March tutorial meeting in case the turnout
for the tutorial is low.

Are there other relevant discussion points I've forgotten?

Does March sound good for a tutorial?  How much interest would there
be from folks on this list or others they might invite?  Are some of
you willing to do some publicity?

Stuart.


From stuartw at mts.net  Thu Feb  1 22:58:58 2007
From: stuartw at mts.net (Stuart Williams)
Date: Thu, 1 Feb 2007 21:58:58 -0600
Subject: [Python Wpg] Some beautiful code
Message-ID: <17858.46850.857344.140939@gavel.swilliams.ca>

Here's a snippet of code we looked at at the last meeting.  To
understand it by example see the tests at the bottom.

I made the comment at the meeting that when I rewrote it to be more
general it was much shorter and simpler.

def old_generate_matches(itera, iterb):
    """Take two iterables which return tuples (key, content).
    Return pairs of items (as a tuple) that share the key
    or an item paired with None if a matching element is missing."""

    needed = object()                   # unique sentinel, so None is allowed in set
    a, b = needed, needed
    
    while True:
        if a is needed:
            try:
                keya, a = itera.next()
                # if a is None:
                #     raise ValueError('Iterable cannot contain None')
            except StopIteration:
                while True:
                    try:
                        keyb, b = iterb.next()
                        yield (None, b)
                    except StopIteration:
                        return
                    
        if b is needed:
            try:
                keyb, b = iterb.next()
                # if b is None:
                #     raise ValueError('Iterable cannot contain None')
            except StopIteration:
                yield (a, None) # we aleady have an A from try above
                while True:
                    try:
                        keya, a = itera.next()
                        yield (a, None)
                    except StopIteration:
                        return

        if keya == keyb:
            yield (a, b)
            a, b = needed, needed
        elif keya > keyb:
            yield (None, b)
            b = needed
        else:
            yield (a, None)
            a = needed

def generate_matches(*iters):
    """Take N iterables which return tuples (key, content).
    Return tuples of items that share the key, filling with
    with None if a matching element is missing."""

    nelements = len(iters)
    needed = object()                   # a sentinel that's better than None
    done = object()
    alldone = [done] * nelements
    keys = [needed] * nelements
    elements = [None] * nelements
    
    while True:                         # always at least one needed when we enter
        for i in range(nelements):
            if keys[i] is needed:
                try:
                    keys[i], elements[i] = iters[i].next()
                except StopIteration:
                    keys[i] = done
                    elements[i] = None
        # we now have 3 values, maybe less, maybe all done
        if keys == alldone:
            break

        minkey = min(keys)
        results = [None] * nelements
        for i in range(nelements):
            if keys[i] == minkey:
                results[i] = elements[i]
                keys[i] = needed
        yield results

def gen_gm(a, b):
    return (iter([(int(e), int(e)) for e in a.split()]),
            iter([(int(e), int(e)) for e in b.split()]))

def test_generate_matches():
    assert (list(generate_matches(*gen_gm('1 2 3', '1 2 3')))
            == [[1, 1], [2, 2], [3, 3]])

    assert (list(generate_matches(*gen_gm('1 2', '1 2 3')))
            == [[1, 1], [2, 2], [None, 3]])

    assert (list(generate_matches(*gen_gm('1 2 3', '1 2')))
            == [[1, 1], [2, 2], [3, None]])

    assert (list(generate_matches(*gen_gm('1 2 4 7 8', '1 2 3 5 6 8')))
            == [[1, 1], [2, 2], [None, 3], [4, None], [None, 5], [None, 6], [7, None], [8, 8]])


From cjnelson at shaw.ca  Fri Feb  2 08:05:33 2007
From: cjnelson at shaw.ca (CJ)
Date: Fri, 02 Feb 2007 07:05:33 -0600
Subject: [Python Wpg] Last meeting, next meeting, and March tutorial idea
References: <17858.46733.502537.595690@gavel.swilliams.ca>
Message-ID: <000601c746ca$d2c718f0$6600a8c0@momdad>

I',m a newbie and would definitely be very interested in this tutorial.

Thank you
Chris


----- Original Message ----- 
From: "Stuart Williams" <stuartw at mts.net>
To: <winnipeg at python.org>
Sent: Thursday, February 01, 2007 9:57 PM
Subject: [Python Wpg] Last meeting, next meeting, and March tutorial idea


> Despite the website wiki at http://winnipug.ca not always being
> up-to-date, we are meeting regularly.  In January I presented some
> ugly and beautiful code as discussed.  I'll post some next.
>
> In February Scott is planning to present, as discussed in November, on
> development with Glade, right Scott?  Feel free to give me a better
> title, or correct me, or edit the wiki yourself.
>
> We had some discussion about making the March meeting a 2-hour Python
> primer or Introduction to Python session targeted at folks who are new
> or potential future Python programmers.  Someone mentioned that April
> might be too late in the year for this to work well.
>
> With respect to who would do the tutorial, I'm willing to organize it
> but would like some others to help.
>
> We talked about the possibility of Syd having his Django (right?)
> presentation, originally scheduled for March but moved to April, ready
> hiding up his sleeve at the March tutorial meeting in case the turnout
> for the tutorial is low.
>
> Are there other relevant discussion points I've forgotten?
>
> Does March sound good for a tutorial?  How much interest would there
> be from folks on this list or others they might invite?  Are some of
> you willing to do some publicity?
>
> Stuart.
> _______________________________________________
> Winnipeg mailing list
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date: 2/1/2007
2:28 PM
>
>



From aklaassen at gmail.com  Mon Feb  5 15:23:53 2007
From: aklaassen at gmail.com (Aaron Klaassen)
Date: Mon, 5 Feb 2007 14:23:53 -0600
Subject: [Python Wpg] Last meeting, next meeting, and March tutorial idea
In-Reply-To: <000601c746ca$d2c718f0$6600a8c0@momdad>
References: <17858.46733.502537.595690@gavel.swilliams.ca>
	<000601c746ca$d2c718f0$6600a8c0@momdad>
Message-ID: <faa9c35c0702051223p1da251a4t73595340d21657bb@mail.gmail.com>

Seconded. I'd definitely make a more significant effort to (finally) show up
if it was a tutorial topic. Unfortunately, four years of Computer Science
doesn't equate to "Python proficiency." :)




On 2/2/07, CJ <cjnelson at shaw.ca> wrote:
>
> I',m a newbie and would definitely be very interested in this tutorial.
>
> Thank you
> Chris
>
>
> ----- Original Message -----
> From: "Stuart Williams" <stuartw at mts.net>
> To: <winnipeg at python.org>
> Sent: Thursday, February 01, 2007 9:57 PM
> Subject: [Python Wpg] Last meeting, next meeting, and March tutorial idea
>
>
> > Despite the website wiki at http://winnipug.ca not always being
> > up-to-date, we are meeting regularly.  In January I presented some
> > ugly and beautiful code as discussed.  I'll post some next.
> >
> > In February Scott is planning to present, as discussed in November, on
> > development with Glade, right Scott?  Feel free to give me a better
> > title, or correct me, or edit the wiki yourself.
> >
> > We had some discussion about making the March meeting a 2-hour Python
> > primer or Introduction to Python session targeted at folks who are new
> > or potential future Python programmers.  Someone mentioned that April
> > might be too late in the year for this to work well.
> >
> > With respect to who would do the tutorial, I'm willing to organize it
> > but would like some others to help.
> >
> > We talked about the possibility of Syd having his Django (right?)
> > presentation, originally scheduled for March but moved to April, ready
> > hiding up his sleeve at the March tutorial meeting in case the turnout
> > for the tutorial is low.
> >
> > Are there other relevant discussion points I've forgotten?
> >
> > Does March sound good for a tutorial?  How much interest would there
> > be from folks on this list or others they might invite?  Are some of
> > you willing to do some publicity?
> >
> > Stuart.
> > _______________________________________________
> > Winnipeg mailing list
> > Winnipeg at python.org
> > http://mail.python.org/mailman/listinfo/winnipeg
> >
> >
> > --
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.432 / Virus Database: 268.17.19/663 - Release Date:
> 2/1/2007
> 2:28 PM
> >
> >
>
> _______________________________________________
> Winnipeg mailing list
> Winnipeg at python.org
> http://mail.python.org/mailman/listinfo/winnipeg
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/winnipeg/attachments/20070205/a0cc1dd5/attachment.html>

From high.res.mike at gmail.com  Mon Feb 26 10:49:54 2007
From: high.res.mike at gmail.com (Mike Pfaiffer)
Date: Mon, 26 Feb 2007 09:49:54 -0600
Subject: [Python Wpg] Another cold -I won't be at the meeting on Wednesday
Message-ID: <45E301A2.7020801@gmail.com>

	I managed a whole three weeks of personal uptime before catching this 
one. It's not as bad as the last one, but it seems I have a constant 
headache and coughing with this one. If it turns out to be a short term 
one I'll make it to the meeting. Otherwise I won't.

	Scott, I'll send you a separate e-mail.

				Later
				Mike