What can you do in LISP that you can't do in Python

James_Althoff at i2.com James_Althoff at i2.com
Wed May 23 14:36:47 EDT 2001


>Alex Martelli wrote:
>
>Does Smalltalk support unnamed, on-the-fly-coded *classes*?  As
>I recall it doesn't (but I could be wrong), and nor does Python.

The Smalltalk language (independent of the standard set of Smalltalk
classes in the Smalltalk development environment) does not have a special,
built-in construct (i.e., "statement") for creating classes -- unlike
Python, in this regard.  In the Smalltalk language (as opposed to the
development environment where you do a lot of things using the gui) you
create a class by invoking a method -- "newClass" let's say for
illustration purposes -- on a metaclass object. (In Smalltalk you do almost
everything by invoking a method on an object).  The "newClass" method
returns a newly created class object.  Since you can implement any kind of
"newClass" method you want in a given metaclass, you can choose to have
your "newClass" method put a class name (a variable that refers to a newly
created class object) in a namespace or not.  The standard Smalltalk
metaclasses (from which you would normally choose to inherit) have methods
that do this (create a variable in a namespace for a newly created class
object); but that is not a requirement of the Smalltalk language.

Jim






More information about the Python-list mailing list