0

I want to understand what does the comma do between self.data and self.next = data. Thanks

class Node(object):
  def __init__(self, data, nxt = None):
    self.data, self.next = data, nxt
class Context(object):
  def __init__(self, source, dest):
    self.source, self.dest = source, dest
Chochu
  • 21
  • 3
  • 3
    Possible duplicate of [Multiple assignment and evaluation order in Python](http://stackoverflow.com/questions/8725673/multiple-assignment-and-evaluation-order-in-python) – Sнаđошƒаӽ Jan 31 '16 at 19:26

1 Answers1

6

This

self.source, self.dest = source, dest

Does this

self.source = source
self.dest = dest

It is just a multivariable definition on a single line

OneCricketeer
  • 151,199
  • 17
  • 111
  • 216