Design question for y'all

Context: python lambda

Better to make classes for dictionary objects holding strings between methods

Throw strings around separately

Throw the dictionary around

  • 1
    Did you know you can search for your assignmet answers on Google?
    @lmgtfy python lambda use cases
  • 1
  • 0
    Maybe this is an important clarification - this is an aws lambda
  • 0
    Doing a full blown class would decrease performance

    Doing strings make a heavier codebase

    Passing a dict around feels dirty
  • 0
    collections.namedtuple is yet another option. 😉
  • 1
    If I'm understanding the question correctly, I seem to recall settling on throwing dictionaries around as my preferred solution to a similar situation. If memory serves, the way python will handle it is essentially "pass by reference", so there's no big performance implication. And that way you can access multiple keys without having to pass them all individually.
Add Comment