loop through arguments, setting as object properties : <p>I have defined a class which uses a constructor that's meant to allow any number of a set of properties be attributed:</p>

<pre><code>class CalendarEvent:
    """Represents a macOS calendar event."""
    def __init__(self, **keyword_arguments):
        self.__allowed_properties = ["starts", "ends", "repeat", "end_repeat", "travel_time", "alert", "notes", "invitees"]
        for key, value in keyword_arguments:
            if key in self.__allowed_properties:
                setattr(self, key, value)
</code></pre>

<p>When I try to create a <code>CalendarEvent</code> though,</p>

<pre><code>party_tomorrow = CalendarEvent(
        starts = datetime.datetime.today() + datetime.timedelta(days = 1),
        ends = datetime.datetime.today() + datetime.timedelta(days = 1, hours = 5),
        repeat = None, 
        end_repeat = None,
        travel_time = datetime.timedelta(hours = 1),
        alert = None,
        notes = "This is gonna be a load of fun.",
        invitees = None
        )
</code></pre>

<p>I get the error:</p>

<pre><code>Traceback (most recent call last):
  File "/Users/George/Library/FlashlightPlugins/calendarquery.bundle/plugin.py", line 62, in test_CalendarEvent
    invitees = None
  File "/Users/George/Library/FlashlightPlugins/calendarquery.bundle/plugin.py", line 12, in __init__
    for key, value in keyword_arguments:
ValueError: too many values to unpack (expected 2)
</code></pre>
