Whither SmallScript? (was Re: Integer micro-benchmarks)

Alex Martelli aleaxit at yahoo.com
Sun Apr 29 07:09:43 EDT 2001


"David Simmons" <pulsar at qks.com> wrote in message
news:sHFG6.29131$Jh5.25559611 at news1.rdc1.sfba.home.com...
    [snip]
> > a class that inherits from another class you simply have:
> >
> > class Foo < Bar
> > def myMethod
> > File.new ("test.dat", "w") { |f|
> > f.puts "Hello world!"
> > }
> > end
> > end
>
> A SmallScript version could be written as:
> =========================================
> class name=Foo extends=Bar {
>     method {
>       myMethod
>         File('test.dat','w') << 'Hello world!'.
>     }
> }

And the Python equivalent would be:

class Foo(Bar):
    def myMethod(self):
        open('test.dat','w').write('Hello world!\n')

so there doesn't seem to be much of a difference in
capabilities at this level -- very different syntax sugar,
of course, but rather similar semantics.

> > Here, class Foo inherits from class Bar.  Except that class Bar is just
an
> > expression that returns a Class object.  In this case it's a constant,
but
> > you could just as easily have:
> >
> > class Foo < someMagicRoutine(someArgument, somethingElse)

Sure, same semantics in Python, of course.


Alex






More information about the Python-list mailing list