Hacker News new | past | comments | ask | show | jobs | submit login

Perhaps an intermediate position be: "You can use a loose dict/map where a different subset of keys/values are in-use for different situations, but there should be a single specific discriminator key-value which is always set, one that unambiguously tells people which form is being used."

That's in contrast to logic like:

    if result.data is not None:
      # Look for successful results
    elif result.error is not None:
      # Log or handle error
    elif result.background_processing:
      # Oops, optional asynchrony
    else:
      # Must be in-progress, right?



Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: