Still trying to figure out what my data structure is

Python's dynamic typing doesn't make this easy...
This commit is contained in:
autocommit 2020-06-01 01:44:39 +00:00 committed by Cy
parent 4e7395babe
commit b221e6a758
No known key found for this signature in database
GPG Key ID: F66D599380F88521
1 changed files with 6 additions and 2 deletions

View File

@ -1,13 +1,17 @@
from pprint import pprint
def maketree(descendants):
try:
lookup = {(descendant.id, descendant) for descendant in descendants}
lookup = [(descendant.id, descendant) for descendant in descendants]
print(descendants[0][0])
lookup = dict(descendants)
except:
from pprint import pprint
pprint(lookup)
raise
replies = {}
roots = set()
for descendant in descendants:
pprint(descendant)
if not descendant.in_reply_to_id:
roots.add(descendant.id)
if descendant.in_reply_to_id in replies: