Fnord Prefect on Nostr: the lack of a real ?: operator in Python still bugs me. "okay" if success else ...
the lack of a real ?: operator in Python still bugs me.
"okay" if success else "error"
looks horrible!
I came up with:
{1:"okay", 0:"error"}[success]
which I like marginally better, I guess.
Does anyone know of a nicer way to put this?
Published at
2024-04-10 15:00:39Event JSON
{
"id": "ca18d6613d7a5bce8a00273781596b6a9272f5c1f83f2deaf0f8be4a5e460d44",
"pubkey": "a07ce7d53a7baeed67f8f5f0876a38259a34607fe25872721b31b6dd8a90c7fc",
"created_at": 1712761239,
"kind": 1,
"tags": [
[
"proxy",
"https://chaos.social/users/fnord/statuses/112247520577086134",
"activitypub"
],
[
"L",
"pink.momostr"
],
[
"l",
"pink.momostr.activitypub:https://chaos.social/users/fnord/statuses/112247520577086134",
"pink.momostr"
]
],
"content": "the lack of a real ?: operator in Python still bugs me.\n\"okay\" if success else \"error\"\nlooks horrible!\n\nI came up with:\n{1:\"okay\", 0:\"error\"}[success]\nwhich I like marginally better, I guess.\n\nDoes anyone know of a nicer way to put this?",
"sig": "3cffca24f96956ad379d296a70e0f456ff17cb003cf42040e8374511654aef5bd5b363d6145a2857b55604eead71e9f3396f83d1cc72507bb56f90196452895e"
}