Ka-Ping Yee <[EMAIL PROTECTED]> wrote: > > On Wed, 23 Mar 2005, Josiah Carlson wrote: > > Paul Moore <[EMAIL PROTECTED]> wrote: > > > I thought about it, but couldn't convince myself that it would work > > > properly in all cases. I was thinking in terms of operator overloading > > > of everything possible - how did you do it? > > > > PyTables allows something very similar for "in-kernel" searches of data, > > but only on a single constraint. I would imagine that Ka-Ping did it by > > only allowing a single operation per item. > > You can do more than one operation, but the usage is still quite limited. > The item placeholder must be the first operand for it to work. > > >>> numbers = [3, 8, 4, 1, 2] > >>> filter(_ < 5, numbers) > [3, 4, 1, 2] > >>> map(_ * 5 + 7, numbers) > [10, 15, 11, 8, 9]
Your implementation "works" by not crashing, but that last map should certainly return [22, 47, 27, 12, 17] rather than what it does. It may be extensible to actually work the way I expect such operations to work. - Josiah _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com