Friday Finking: initialising values and implied tuples

2QdxY4RzWzUUiLuE at potatochowder.com 2QdxY4RzWzUUiLuE at potatochowder.com
Fri Apr 2 23:09:22 EDT 2021


On 2021年04月03日 at 02:41:59 +0100,
Rob Cliffe via Python-list <python-list at python.org> wrote:
>     x1 = 42; y1 =  3;  z1 = 10
>     x2 = 41; y2 = 12; z2 = 9
>     x3 =  8;  y3 =  8;  z3 = 10
> (please imagine it's in a fixed font with everything neatly vertically
> aligned).
> This has see-at-a-glance STRUCTURE: the letters are aligned vertically
> and the "subscripts" horizontally.  Write it as 9 lines and it becomes
> an amorphous mess in which mistakes are harder to spot.

I agree that writing it as 9 lines is an accident waiting to happen, but
if you must see that structure, then go all in:
 (x1, y1, z1) = (43, 3, 10)
 (x2, y2, z2) = (41, 12, 9)
 (x3, y3, z3) = ( 8, 8, 10)
Or even:
 ((x1, y1, z1)
 (x2, y2, z2)
 (x3, y3, z3)) = ((43, 3, 10)
 (41, 12, 9)
 ( 8, 8, 10))
Or not. YMMV. I guess this doesn't come up enough in my own code to
worry about it.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /