Prothon Prototypes vs Python Classes

Joe Mason joe at notcharles.ca
Sun Mar 28 12:58:35 EST 2004


In article <69cbbef2.0403280928.438d194f at posting.google.com>, has wrote:
> # Library pseudocode
> 
> _fooRegistry = []
> 
> obj _Foo: # prototype object
>     # Foo's code goes here
> 
> def Foo(): # constructor function
>     newFoo = _Foo.copy()
>     _fooRegistry.append(newFoo)
>     return newFoo
> 
> 
> Dirt simple with not an ounce of class metaprogramming in sight.

Is Foo() the standard syntax for making a new _Foo object?  If this is a
new wrapper you just created, then it's no different than adding a
register() method - the user has to know that something different is
being done.

If Foo() is the standard syntax, and you're just overriding the
implementation here, does that get inherited?  If so, this missed the
condition that only some of the descendants should get added to the
registry.  If not - well, inheriting the constructor seems like the more
useful behaviour in general, so why not?

Joe



More information about the Python-list mailing list