블록체인 트랜잭션 관련해서 클래스로 정리하려고 한단말야?? 객체지향 책 읽고나서 뭔가 뭔가 느껴지는거임
class ProvideTx(BasicTx):def __init__(self, token, created_at, lp_amount, usd_value):
super().__init__(token, created_at)
self.lp_amount = lp_amount
self.usd_value = usd_value
그래서 이렇게 해서 리스트에다 쳐넣었지 대충 사용자가 사용할 클래스의 sorted_txs 클래스 속성에 얘네를 쳐넣었음
for tx in self.txs_history:
if tx['type'] == 'STAKE' or tx['type'] == 'UNSTAKE':
tx_class = refine_farm_data(tx)
refined_dict[tx_class.token].append(tx_class)
elif tx['type'] == 'PROVIDE_LIQUIDITY' or tx['type'] == 'WITHDRAW_LIQUIDITY':
tx_class = refine_liquidity_data(tx)
refined_dict[tx_class.token].append(tx_class)
self.sorted_txs = refined_dict
그래서, 이렇게 하고나서 print(self.sorted_txs)를 쳐 하면 이렇게 다 뜬다??
[<interact.interact_mirror.ProvideTx object at 0x000001809B5EBE50>, <interact.interact_mirror.StakeTx object at 0x000001809B5EBE80>, <interact.interact_mirror.WithdrawTx object at 0x000001809B5EB040>]
근데 문제인건 이 개같은게 나는 ProvideTx 애들을 가지고와서 죽을 쑤든 밥을 짓든 하고 싶은데, 이놈들을 어케 가져와야하는지 모르겠음
책을 보면 isinstance(인스턴스, 클래스) 이런식으로 하던데, 난 다 False가 뜬다 이거지 isinstace(리스트에 있는 놈 하나, ProvideTx클래스 임포트 해온거) 이따구로해도 이 악물고 False가 뜸. 그냥 내 능지가 잘못된건가?? 뭐가 문제임??
파이썬은 따로 관리하는 JVM가 있겠노?
?? 먼솔이여 JVM이 왜나옴