Newbie questions part 2, thanks
Paul Rubin
phr-n2001d at nightsong.com
Thu Nov 15 11:45:35 EST 2001
"David Grenier" <grenieda at hotmail.com> writes:
> Thanks, it worked...
>
> Now here:
>
> Whenever I call cons.mappe(lambda x:2*x, cons(1,[]))
When you call cons.mappe(x,y), the method actually gets called
with 3 args. The first is bound to cons itself. Normally
you define a method like this:
def methodname(self, arg1, arg2): ...
Also you can rewrite
> if type(schemelist.cdr) is InstanceType and schemelist.cdr.__class__==cons:
as
if isinstance(schemelist.cdr, cons):
Please try reading through the Python language reference to understand
this stuff.
More information about the Python-list
mailing list