assignments - want a PEP

Kay Schluehr kay.schluehr at gmx.net
Fri Apr 1 00:11:06 EST 2005


Bengt Richter wrote:
> you can do what you like, pretty much. I.e.,
>
>     cas = CAS()
>     cas.a        # like your plain a, where you said "that's it"
>
>
>     cas.a, cas.b = cas.Expr(), cas.Expr()
>     (cas.a + cas.b)/cas.c
>
> Etc.

Hmmm... feels like a good idea if extended to use properties as special
constructors:

>>> expr = CAS(Expr)
>>> expr.a
a
>>> type(expr.a)
<type 'Expr'>

>>> expr.a+expr.b
a+b

or a bit shorter if Expr becomes the "master algebra":

>>> _ = CAS(Expr)
>>> _.a + _.b
a+b

Regarding that an object oriented CAS will mix an arbitray number of
algebras/namespaces that use algebraic operators homogenously
referencing namespaces is a reasonable for providing clarity.

A helpfull suggestion. Thanks Bengt!

Regards,
Kay


Regards,
Kay




More information about the Python-list mailing list