Le 04/11/2021 à 16:41, Stefan Ram a écrit :
ast <ast@invalid> writes:
(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.

   But the value of the right-hand side /always/ is a single object!

   A syntax of an assignment statement that has been simplified
   by me but is sufficient for this post is:

target list = source expression

   . The evaluation of the source expression yields an object.

   If the target list is not a single target, that object must
   be an iterable with the same number of items as there are targets
   in the target list, and the items are assigned, from left to
   right, to the corresponding targets.

   A generator object /is/ an iterable, and, here, it apparently
   yields exactly two items.



understood

It is like:

x, y = (i for i in range(2))

thx
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to