Uvicorn & Gunicorn
Uvicorn and GunicornUvicorn and Gunicorn are important concepts when developing applications in Python. However, there are many concepts to be aware of in order to fully understand Uvicorn and Gunicorn. The following is a brief summary of the necessary concepts, and the details will be dealt with separately later.Necessary ConceptsStarletteStarlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.FastAPIFastAPI provides many features on top of Starlet...
Gas optimization in Solidity, Ethereum
I’m sorry but my English is terrible. I hope you understand that generously.Recently, I was developing a toy project named Blind Market. It’s a simple P2P trading application using smart contract. I was making a contract using Solidity, and the trade stage proceeded in the order of pending, shipping, and done. The problem was appeared in done phase. The problem was that when I tried to close the transaction by paying the price raised by the seller in msg.value, the following error occurred.Pe...
P2WPKH
P2WPKHP2WPKH란 비트코인 내에서 가장 일반적인 스크립트 형식으로 비트코인 프로토콜에 대한 지불 거래 유형이다. 주소는 1로 시작하는데, 세그윗을 지원하는 새로운 주소 3 또는 bc1로 시작하는 주소보다 훨씬 비싸다. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 즉, 비트코인 주소가 1로 시작하면 P2PKH 주소를 사용하고 있는 것이다. 공개키의 간단한 해시이며, 이 해시를 주소로 사용하는 것이다. 이것은 원래 비트코인 주소 형식이었으며 오늘까지도 충실히 작동한다. 레거시 주소는 세그윗과 호환되지 않지만, 여전히 문제없이 P2PKH 주소에서 세그윗 주소로 BTC를 보낼 수 있다. 그러나 레거시 주소 트랜잭션이 더 크기 때문에 P2PKH 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
<100 subscribers
Uvicorn & Gunicorn
Uvicorn and GunicornUvicorn and Gunicorn are important concepts when developing applications in Python. However, there are many concepts to be aware of in order to fully understand Uvicorn and Gunicorn. The following is a brief summary of the necessary concepts, and the details will be dealt with separately later.Necessary ConceptsStarletteStarlette is a Web application server that can run asynchronously. Starlette runs on top of Uvicorn.FastAPIFastAPI provides many features on top of Starlet...
Gas optimization in Solidity, Ethereum
I’m sorry but my English is terrible. I hope you understand that generously.Recently, I was developing a toy project named Blind Market. It’s a simple P2P trading application using smart contract. I was making a contract using Solidity, and the trade stage proceeded in the order of pending, shipping, and done. The problem was appeared in done phase. The problem was that when I tried to close the transaction by paying the price raised by the seller in msg.value, the following error occurred.Pe...
P2WPKH
P2WPKHP2WPKH란 비트코인 내에서 가장 일반적인 스크립트 형식으로 비트코인 프로토콜에 대한 지불 거래 유형이다. 주소는 1로 시작하는데, 세그윗을 지원하는 새로운 주소 3 또는 bc1로 시작하는 주소보다 훨씬 비싸다. https://mirror.xyz/0xA1d9f681B25C14C1eE7B87f1CF102E73cA3ad4d9/egjhNVklgy_LgZmcTXXAOTBa6ePBqO3Ja9ZSoDIad-8 즉, 비트코인 주소가 1로 시작하면 P2PKH 주소를 사용하고 있는 것이다. 공개키의 간단한 해시이며, 이 해시를 주소로 사용하는 것이다. 이것은 원래 비트코인 주소 형식이었으며 오늘까지도 충실히 작동한다. 레거시 주소는 세그윗과 호환되지 않지만, 여전히 문제없이 P2PKH 주소에서 세그윗 주소로 BTC를 보낼 수 있다. 그러나 레거시 주소 트랜잭션이 더 크기 때문에 P2PKH 주소에서 전송하는 평균 속도는 세그윗 주소에서 전송할 때보다 더 높은 요금이 발생할 수 있다....
Share Dialog
Share Dialog
클래스에 아무 decorator 없이 method를 선언하면 해당 method는 instance method로 취급이 되며, 첫 번째 parameter로 클래스의 instance가 넘어오게 된다.
이 첫 번째 parameter의 이름은 self라고 하며, self.attribute …를 통해 instance/class 속성에 접근하거나 instance/class method를 호출할 수 있다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod decorator를 사용해서 클래스에 method를 선언하면
해당 method는 class method가 되며, 첫 번째 parameter로 self가 아닌 cls라는 이름으로 클래스 자체가 넘어오게 된다.
클래스 method는 이 cls를 통해 클래스 속성에 접근하거나, 다른 class method를 호출할 수 있다.
하지만, instance method와 달리 instance 속성에 접근하거나 다른 instance method를 호출하는 것은 불가능하다.
Python에서는 생성자 overloading을 지원하기 때문에, Class method는 주로 Factory method를 작성할 때 유용하게 사용된다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod
def newCounterFromTuple(cls, tup):
return cls(tup[0])
@classmethod
def newCounterFromArray(cls, arr):
return cls(arr.pop())
@staticmethod decorator를 사용해서 method를 선언하면 해당 method는 정적 method가 된다.
정적 method는 instance method나 class method와 달리 첫 번째 parameter가 할당되지 않는다.
따라서 정적 method 내에서는 instance/class 속성에 접근하거나, instance/class method를 호출하는 것이 불가능하다.
바꾸어말하면, 접근할 필요가 없을 때 사용하면 되기 때문에, 주로 utility method를 작성할 때 유용하다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod
def newCounterFromTuple(cls, tup):
return cls(tup[0])
@classmethod
def newCounterFromArray(cls, arr):
return cls(arr.pop())
@staticmethod
def PrintInformation():
print("This is a counter")
클래스에 아무 decorator 없이 method를 선언하면 해당 method는 instance method로 취급이 되며, 첫 번째 parameter로 클래스의 instance가 넘어오게 된다.
이 첫 번째 parameter의 이름은 self라고 하며, self.attribute …를 통해 instance/class 속성에 접근하거나 instance/class method를 호출할 수 있다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod decorator를 사용해서 클래스에 method를 선언하면
해당 method는 class method가 되며, 첫 번째 parameter로 self가 아닌 cls라는 이름으로 클래스 자체가 넘어오게 된다.
클래스 method는 이 cls를 통해 클래스 속성에 접근하거나, 다른 class method를 호출할 수 있다.
하지만, instance method와 달리 instance 속성에 접근하거나 다른 instance method를 호출하는 것은 불가능하다.
Python에서는 생성자 overloading을 지원하기 때문에, Class method는 주로 Factory method를 작성할 때 유용하게 사용된다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod
def newCounterFromTuple(cls, tup):
return cls(tup[0])
@classmethod
def newCounterFromArray(cls, arr):
return cls(arr.pop())
@staticmethod decorator를 사용해서 method를 선언하면 해당 method는 정적 method가 된다.
정적 method는 instance method나 class method와 달리 첫 번째 parameter가 할당되지 않는다.
따라서 정적 method 내에서는 instance/class 속성에 접근하거나, instance/class method를 호출하는 것이 불가능하다.
바꾸어말하면, 접근할 필요가 없을 때 사용하면 되기 때문에, 주로 utility method를 작성할 때 유용하다.
class Counter:
def __init__(self, value=0):
self.value = value
def increment(self, delta=1):
self.value += delta
def decrement(self, delta=1):
self.value -= delta
@classmethod
def newCounterFromTuple(cls, tup):
return cls(tup[0])
@classmethod
def newCounterFromArray(cls, arr):
return cls(arr.pop())
@staticmethod
def PrintInformation():
print("This is a counter")
No comments yet