[Tutor] Re: Factory classes

Sean 'Shaleh' Perry shalehperry@attbi.com
Tue, 3 Sep 2002 16:37:06 -0700


On Tuesday 03 September 2002 16:32, Scot W. Stevenson wrote:
>
> Well, at least that's how I understand factories. Now if somebody could
> tell me if any of this is actually correct, I'd feel much better =3D8).
>
> Y, Scot

yeah, you got it pretty much right.

One side comment.

def foo():
    result =3D computation()
    return result

is a little silly just write 'return computation()'.  In several language=
s=20
(not sure about python) writing the code this way allows the compiler to=20
optimize the function call so that the return result is written directly =
into=20
the caller's stack so no actual return is executed which means faster, mo=
re=20
efficient function calls.