Sigurd Meldgaard <[EMAIL PROTECTED]> writes:

> # HG changeset patch
> # User Sigurd Meldgaard <[EMAIL PROTECTED]>
> # Date 1221574030 -7200
> # Node ID f879ad687faab381f1208885a5c1330265e3e119
> # Parent  5aa168c8778a1e2909cda7c1ea08da8501b66a95
> Added a function viff.runtime.make_runtime_class, that creates a new runtime 
> class with mixins

Please try to make the first line in the commit message fit in 80 chars,
otherwise it looks weird in my terminals :-) Then put the bigger
description in a paragraph after the first line.

> diff -r 5aa168c8778a -r f879ad687faa viff/runtime.py
> --- a/viff/runtime.py Tue Sep 16 16:11:10 2008 +0200
> +++ b/viff/runtime.py Tue Sep 16 16:07:10 2008 +0200
> @@ -1079,6 +1079,19 @@
>          result.addCallback(shamir.recombine)
>          return result
>  
> +def make_runtime_class(runtime_class = Runtime, mixins = ()):

No space around default arguments in functions. Also, I don't think it
makes sense to give mixins as default argument -- people should only use
this function if they actually have something to mix.

> +    """Creates a new runtime class with runtime_class as a base class
> +    mixing in the mixins.

Please mark parameters a *runtime_class* in the docstrings, that makes
the Sphinx generated output nicer.

> +    mixins must be a list or tuple of mixin-classes.
> +    """
> +
> +    # We must include at least one new-style class in bases. We
> +    # include it last to avoid overriding __init__ from the other base
> +    # classes.
> +    bases = (runtime_class,) + tuple(mixins) + (object,)
> +
> +    return type("ExtendedRuntime", bases, {})

Great idea with such a function so that people wont have to do the scary
dynamic class stuff themselves -- could you please make another patch
which updates apps/benchmark.py to use this function?


-- 
Martin Geisler

VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.

Attachment: pgpxnDD5vOJUJ.pgp
Description: PGP signature

_______________________________________________
viff-patches mailing list
viff-patches@viff.dk
http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk

Reply via email to