A little present.
Neel Krishnaswami
neelk at brick.cswv.com
Mon Feb 14 20:43:36 EST 2000
Michael Hudson <mwh21 at cam.ac.uk> wrote:
>
> The idea is that after a call to X(func,...) there are a number of
> `holes' (notated by an empty tuple) in the arglist that can be `filled
> in' by subsequent calls (to what X returns). This means you can't
> presupply the empty tuple to func, but I couldn't think of a better
> way.
Here's one:
class Hole:
pass
Then change the test
def __init__(self, func, *args):
[...]
if args[i] == ():
to
def __init__(self, func, *args):
[...]
if args[i] is Hole:
Since Hole is a unique object, there isn't anything else that 'is'
Hole. If you ever find yourself needing to pass Hole as an argument,
then add "hole=Hole" to the __init__ arglist and let people change
what the hole object by overriding the default argument.
Neel
More information about the Python-list
mailing list