define

Dan Bishop danb_83 at yahoo.com
Fri May 9 22:20:48 EDT 2003


bokr at oz.net (Bengt Richter) wrote in message news:<b9gobu$ndd$0 at 216.39.172.122>
...
> I can sympathize with a desire to avoid writing, e.g.,
> 
>     x.y = (-x.b + x.sign*sqrt(x.b**2 - 4.0*x.a*x.c))/2.0*x.a
> 
> in favor of something like, e.g.,
> 
>     using y, b, sign, a, c with x:
>         y = (-b + sign*sqrt(b**2 - 4.0*a*c))/2.0*a

But this requires you to type 12 extra characters.  What's the advantage?

> Or, perhaps, alternatively,
> 
>     with (y, b, sign, a, c) in x:
>         y = (-b + sign*sqrt(b**2 - 4.0*a*c))/2.0*a
> 
> Or, when it applies to every symbol used (same-line suite optional, of course),
> 
>     with x: y = (-b + sign*sqrt(b**2 - 4.0*a*c))/2.0*a

That wouldn't work: sqrt isn't an attribute of x.

Or if it did work, how would you know which names belonged to x and which didn't?

I don't like the idea at all.

> Perhaps it's time to reexamine whether it could be done nicely somehow?




More information about the Python-list mailing list