code suite as first class object ?
Sean Ross
sross at connectmail.carleton.ca
Sat Jun 28 23:11:08 EDT 2003
The code in the last post looked a bit messed up on my newsreader, so here
it is again:
MyClass = object with:
"""MyClass = object(thunk), where object
returns a class defined using thunk
"""
__init__ = method with self, foo:
"""__init__ = method(thunk), where method
returns a method defined using thunk
"""
self._foo = foo
foo = property with:
"property foo's docstring"
fget = with self:
return self._foo
fset = with self, value:
self._foo = value
bar = static, method with:
"bar = static(method(thunk))"
1.upto(10) do with i:
print "upto() yeilds %d which is passed to ", \
"the thunk. The thunk is passed to do ", \
"(do(thunk)), where it gets executed, ", \
"and so you see this!" % i
More information about the Python-list
mailing list