A critic of Guido's blog on Python's lambda

Ken Tilton kentilton at gmail.com
Mon May 15 02:28:37 EDT 2006



Lasse Rasinen wrote:
> Ken Tilton <kentilton at gmail.com> writes:
> 
> 
>>>if any concepts have survived to the Python version. Since Python's object
>>>model is sufficiently different, the system is based on rules being
>>>defined per-class...
>>
>>That will be a total disaster for PyCells, if true. But I do not think it
>>is. You just need a constructor that takes some slot initializers, and
>>initialize the slots to one of: a normal value; an InputCell itself
>>initialized with a starting value, if only nil; or a RuledCell itself
>>initialized with a lambda.
> 
> 
> Hmm, just tried it:
> 
> 
>>>>class A(cells.cellular):
> 
> ...   def __init__(self):
> ...     self.a = cells.InputCell(10)
> ...     self.b = cells.RuleCell(lambda self: self.a+1, self, None)
> 
> 
>>>>a = A()
>>>>a.a
> 
> 10
> 
>>>>a.b
> 
> 11
> 
> So it does work out-of-the-box ;-)

So why exactly did you say that the differences in the object model made 
it impossible? I was really stunned by that claim. And you sounded so 
confident. What went wrong there? It was trivial, right? How did you 
miss that?

> 
> 
>>PyCells looks like it will be a project for SoC2006, so you may as well
>>relax.
> 
> 
> You really want to start a SoC project on something that takes about two
> weeks ...

You sound so confident. :)

Do you know the deliverables? I know you do not know Cells. You say you 
looked at the code -- it does not show. I can also tell you have not 
done much serious programming, or you would know that twelve weeks is 
more like twelve minutes than three months.

A new test suite, documentation (a first, there is none now), a full 
port of Cells in all their ten years of sophisticated evolution and 
variety (no, not your stupid pet trick), and as a demo project an entire 
cells-driven GUI, probably a port of my new Celtk (+ Cells Tk) work, all 
in a language without macros, without special variables, with a more 
modest OO system, and limited first class functions... oh, I think we'll 
keep him busy. :)

Now since you are such a genius, maybe you can help with something. 
Trust me on this: this is one place where macros would be able to hide a 
ton of implementation wiring it does no one any good to look at, and 
actually turns into a maintenance nightmare whenever Cells might get 
revised.

Is there any experiemntal macro package out there for Python? Maybe a 
preprocessor, at least? Or are there ways to actually hack Python to 
extend the syntax? My honest guess is that Cells will port readily to 
Python but leave everyone very interested in finding some way to hide 
implementation boilerplate. Got anything on that?

kenny




More information about the Python-list mailing list