일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- 프로그래머스
- 109. Convert Sorted List to Binary Search Tree
- concurrency
- 시바견
- iterator
- shiba
- Generator
- Python Code
- DWG
- 밴픽
- 파이썬
- kaggle
- 컴퓨터의 구조
- LeetCode
- Substring with Concatenation of All Words
- 운영체제
- 315. Count of Smaller Numbers After Self
- 715. Range Module
- 43. Multiply Strings
- 30. Substring with Concatenation of All Words
- Regular Expression
- Class
- Decorator
- Convert Sorted List to Binary Search Tree
- Python
- Protocol
- attribute
- t1
- data science
- Python Implementation
- Today
- Total
목록분류 전체보기 (407)
Scribbling
Web downloads in three different styles - sequential download - concurrent.futures - asyncio With heavy input/output workload, we can make the best out of concurrency. Below is the code that downloads flag gif files sequentially. import os import time import sys import requests POP20_CC = ('CN IN US ID BR PK NK BD RU JP' 'MX PH VN ET EG DE IR TR CD FR').split() BASE_URL = 'http://flupy.org/data/..
Basic behavior of Coroutines def coroutine(): print('started') x = yield print('received: ', x) c = coroutine() next(c) c.send(3) 1) "next(c)" or "c.send(None)" primes the coroutine -> coroutine now waits at 'yield' expression 2) c.send(3) sets x to 3, re-executing the coroutine 3) At the end, coroutine raises StopIteration Example: coroutine to compute a running average def averager(): total, c..
For a given recipe, we need to check whether all the necessary elements can be supplied. If an element belongs to supplies, it's a piece of cake. Now the question is to deal with elements that belong to recipes. We can think of recipes as a graph with cycles. Plus, if there's a cycle among certain recipes, they can never be cooked. class Solution: def findAllRecipes(self, recipes: List[str], ing..
Else block For-Else Else block is executed when the 'for loop' was not stopped by any break. for i in range(1, 1): else: print('Else block is executed') for i in range(1, 10): if i == 8: break else: print('Else block is executed') While-Else Works the same for 'for-else'. while False: break else: print('Else block executed') Try-Else try: dangerous_call() after_call() except OSError: log('OSErro..
Sequence Protocol To make a custom data type have Sequence Protocol, you need to implement "__iter__" method. Even though "__getitem__" method is enough for now, you should implement "__iter__" method as well for later compatibility. A classic iterator Below is a classic implementation - not a rolemodel - of an iterator. import re import reprlib class Sentence: def __init__(self, text): self.tex..
In this post, we add operator overloading code to custom 'Vector' class in the previous post. https://focalpoint.tistory.com/300 Python: Sequence Protocol To learn sequence protocol in Python, we create a custom vector class. from array import array import math import reprlib class Vector: typecode = 'd' def __init__(self, components): self._component.. focalpoint.tistory.com Vector Class is as ..
Risks of subclassing built-in types - Generally, overriden methods in sub-classes are not called by other built-in methods. class StrangeDict(dict): def __setitem__(self, key, value): super().__setitem__(key, value*2) dic = StrangeDict(one=1) dic['1'] = 1 dic.update(three=3) print(dic) - This is because some methods are written with C-language. - So, use UserDict, UserList, UserString if you nee..
What is interface? Interface is a set of public methods. In python, 'X object', 'X protocol' and 'X interface' have the same meaning. In Python, protocol is pretty dynamic. In below example, FrenchDeck class does not inherit any class (other than default 'object' class). However, the class has sequential protocol as it has two magic methods (__len__, __getitem__). Likewise, in Python, object's d..
Architecture for MLOps using TFX, Kubeflow Pipelines, and Cloud Build Link: https://cloud.google.com/architecture/architecture-for-mlops-using-tfx-kubeflow-pipelines-and-cloud-build TFX, Kubeflow 파이프라인, Cloud Build를 사용하는 MLOps 아키텍처 | 클라우드 아키텍처 센터 | Googl 의견 보내기 TFX, Kubeflow 파이프라인, Cloud Build를 사용하는 MLOps 아키텍처 이 문서에서는 TensorFlow Extended(TFX) 라이브러리를 사용하는 머신러닝(ML) 시스템의 전반적인 아키텍처를 설명합니다. 또한 C clou..
The main goals we use 'Abstract Base Class' in python are as follows: - to provide a standerdized way to test whether an object adheres to a certain specification - to prevent any attempt to initiate a subclass that does not override methods of the super class 1> To provide a standerdized way to test whether an object adheres to a certain specification import abc class TypeGroup1(metaclass=abc.A..