Syntax not understood
David Lowry-Duda
david at lowryduda.com
Thu Nov 4 14:36:48 EDT 2021
> x_increment, y_increment = (scale * i for i in srcpages.xobj_box[2:])
>
> (scale * i for i in srcpages.xobj_box[2:]) is a generator, a single
> object, it should not be possible to unpack it into 2 variables.
If you know the exact number of values in the generator, you can do
this. Here is an oversimplified example.
l = [0, 1, 2, 3, 4, 5]
a, b = (elem * 10 for elem in l[:4])
print(a, b) # prints 40 50
This is very fragile code and I would recommend against using it.
- DLD
More information about the Python-list
mailing list