Talk given at DomCode meetup in Utrecht (August 2014) on different frameworks to do asynchronous I/O y Python, with a strong focus on asyncio (PEP-3156).
~10min dive to Python Asynchronous IO
HTML version (recommended): https://dl.dropboxusercontent.com/u/1565687/speak/Python3%20AsyncIO%20Horizon/index.html
Practical continuous quality gates for development processAndrii Soldatenko
There are a lot of books and publications about the continuous integration in the world. But in my experience it’s difficult to find information about how to open quality gates between automated tests and to continuous integration practice to in your current project. After reading several articles and even a couple of books you will understand how to work with it. But what next? I will share with you practical tips and tricks on how to lift iron curtain to your automated tests before a continuous quality practice today. It is for this reason why I am pleased to share with you my acquired experience in my presentation.
https://www.youtube.com/watch?v=Dv1bpmYV0vU
Channels is the most exciting thing to happen to Django since, well, Django! It is both an elegant and backwards compatible extension of the core Django request response model to allow direct support of WebSockets and lightweight async tasks. This talk will cover the current state of Channels, work through an asynchronous task example, touch on deployment and point towards other resources.
What is the best full text search engine for Python?Andrii Soldatenko
Nowadays we can see lot’s of benchmarks and performance tests of different web frameworks and Python tools. Regarding to search engines, it’s difficult to find useful information especially benchmarks or comparing between different search engines. It’s difficult to manage what search engine you should select for instance, ElasticSearch, Postgres Full Text Search or may be Sphinx or Whoosh. You face a difficult choice, that’s why I am pleased to share with you my acquired experience and benchmarks and focus on how to compare full text search engines for Python.
Social phenomena is coming. We have lot’s of social applications that we are using every day, let’s say Facebook, twitter, Instagram. Lot’s of such kind apps based on social graph and graph theory. I would like to share my knowledge and expertise about how to work with graphs and build large social graph as engine for Social network using python and Graph databases. We'll compare SQL and NoSQL approaches for friends relationships.
2. Outline
1. Understanding Class
2. Initialization Function : __init__()
3. Class Variable & Instance Variable
4. Data Hiding & Name Mangling
5. Getter, Setter and @property
6. Inheritance & Mixin & Polymorphism
3. Understanding Class
함수 : 특정 행위에 대해 기술한 소스 코드
클래스 : 특정 행위와 상태를 담을 수 있는 객체를 생성하기 위한 명세서
모듈 : 함수, 클래스 등을 포함하여 독립적인 파일(.py)로 저장하여 언제든지 호
출하여 재사할 수 있는 공통 소스 코드들의 집합
Don’t Repeat Yourself!
>>> “같은 소스를 반복해서 작성하지 말라”
소스 재사용
4. Understanding Class
함수 : 특정 행위에 대해 기술한 소스 코드
클래스 : 특정 행위와 상태를 담을 수 있는 객체를 생성하기 위한 명세서
모듈 : 함수, 클래스 등을 포함하여 독립적인 파일(.py)로 저장하여 언제든지 호
출하여 재사할 수 있는 공통 소스 코드들의 집합
Don’t Repeat Yourself!
>>> “같은 소스를 반복해서 작성하지 말라”
소스 재사용
8. Understanding Class
특정 상태 : Attribute
특정 행위와 상태를 담을 수 있는 객체를 생성하
기 위한 명세서
1. 클래스의 정의
특정 행위 : Method
명세서 : Class Name
클래스의 3요소 : 클래스명, 속성, 메소드
9. Understanding Class
Bom은 23살이다
Bom은 인하대학교를 다닌다
Bom은 간수치가 40이다
Bom은 술을 마시면 간수치가 50증가한다
Bom은 휴식을 취하면 간수치가 50떨어진다
1. 클래스의 정의
속성과 행위로 나눈다
속성 : Bom, 23살, 인하대 재학, 간수치40
행위 : 술마시면 간수치 +50, 휴식하면 간수치-50
10. Understanding Class
1. 클래스의 정의
class Bom:
name = ‘Bom’
age = 23
univ = “Inha”
liver_state = 40
def drink_alcohol(self):
liver += 50
print( name, “이가 술을 마십니다”)
def rest(self):
liver -= 50
print( name, “이가 휴식을 취합니다”)
Bom은 23살이다
Bom은 인하대학교를 다닌다
Bom은 간수치가 40이다
Bom은 술을 마시면 간수치가 50증가한다
Bom은 휴식을 취하면 간수치가 50떨어진다
클래스 내부함수의
첫 인자는 self
11. Understanding Class
2. 클래스의 사용
bom = Bom()
print(bom.name + ‘은 ’ + bom.univ + ‘대학교에 다닙니다’ )
bom.drink_alcohol()
print(bom.liver)
bom.rest()
print(bom.liver)
변수 = 클래스이름()
변수.속성이름
변수.함수이름()
Bom은 Inha대학교에 다닙니다
Bom이가 술을 마십니다
90
Bom이가 휴식을 취합니다
40
12. 초기화 함수 내부에 선
언된 변수에는 self 키
워드가 붙는다
초기화 함수 : __init__()
1. __init___()
class Bom:
def __init__(self, name, age, univ)
print(‘초기화 함수 시작’)
self.name = name
self.age = age
self.univ = univ
self.liver_state = 40
def drink_alcohol(self):
liver += 50
print( name, “이가 술을 마십니다”)
def rest(self):
liver -= 50
print( name, “이가 휴식을 취합니다”)
C++ 과 Java의 생성자 함수와 같은 역할
클래스가 생성된 직후에 바로 실행된다 클래스 내부함수의
첫 인자는 self
13. 초기화 함수 : __init__()
2. __init___() 사용
yang= Bom(‘양욱’, 20, ’인하’)
print(yang.name + ‘은 ’ + bom.univ + ‘대학교에 다닙니다’ )
yang.liver = 50
print(yang.liver)
yang.rest()
print(yang.liver)
초기화 함수 시작
양욱은 인하대학교에 다닙니다
90
Bom이가 휴식을 취합니다
140
14. 초기화 함수 : __init__()
3. 주의사항
class Bom:
self.univ = ‘연세’
def __init__(self, name, age)
print(‘초기화 함수 시작’)
self.name = name
self.age = age
self.liver_state=40
__init__함수 밖에 self.변수이름 선언 안됨
class Bom:
def __init__(self, name)
self.name = name
self.age
b = Bom(“bom”)
print(b.age)
초기화 되지 않은 변수를 참조하면 에러
15. 클래스 변수&인스턴스 변수
1. self
class Bom:
self.univ = ‘연세’
def __init__(self, name, age, univ)
print(‘초기화 함수 시작’)
self.name = name
self.age = age
self.liver_state=40
C++과 Java의 this 키워드와 같은 역할
지금 현재 속해있는 클래스를 참조한다
클래스 내부 함수의 첫 인자는 모두 self
class Bom:
def __init__(self, name, age, univ)
print(‘초기화 함수 시작’)
self.name = name
self.age = age
여기서 self는 모두
Bom클래스의 주소를
참조한다
초기화 함수 밖에 사용하면 안되는 이유!?
함수의 인자 self를
사용한것!
16. 클래스 변수&인스턴스 변수
2. 클래스 객체와 인스턴스 객체의 namespace
class Bom:
name = ‘Bomin’
def __init__(self)
self.age = 23
>>> b1 = Bom()
>>> b1.name = ‘JumBomin
name=‘JumBomin’
b1(인스턴스)
name=‘Bomin’
Bom(클래스)
18. 데이터은닉&이름장식
1. 데이터 은닉 (Data Hiding)
클래스의 내부 변수를 외부에서 접근하지 못하게 숨기는 것
변수의 신뢰도를 높혀준다
캡슐화 (Encapsulation)라고 부르기도 함
어떻게 접근을 못하게할까?
class Bom:
name = ‘Bomin’
>>> b1 = Bom()
>>> b1.name
Bomin
19. 데이터은닉&이름장식
2. 이름 장식 (Name Mangling)
변수앞에 __(언더스코어 두개)를 붙혀
클래스 외부에서 접근하지 못하게 한다
어떻게 접근을 못하게할까?
class Bom:
__name = ‘Bomin’
>>> b1 = Bom()
>>> b1.name
AttributeError: type object ‘Bom’ has no atrribute ‘name’
>>> b1.__name
AttributeError: type object ‘Bom’ has no atrribute ‘__name’
22. 데이터은닉&이름장식
2. 이름 장식 (Name Mangling)
_클래스명__변수명으로 접근가능
class Bom:
__name = ‘Bomin’
>>> b1 = Bom()
>>> b1._Bom__name
Bomin
그럼 데이터 은닉이
안되는거 아니에요?
23. 데이터은닉&이름장식
2. 이름 장식 (Name Mangling)
_클래스명__변수명으로 접근가능
class Bom:
__name = ‘Bomin’
>>> b1 = Bom()
>>> b1._Bom__name
Bomin
파이썬은 Java나 C++과 다르게 데이터 은닉이 약한 언어입니다.
>>> dir()로 namespace를 확인할 수도 있고
>>> _클래스명_변수명 으로 접근도 가능
31. 상속
1. 상속이란?
Base Class
Derived Class
Base Class : 부모 클래스, 물려줄 속성과 메소드 정의
Derived Class : 자식클래스, 부모로부터 속성과 메소드 물려받음
클래스마다 동일한 코드 작성되는 것 방지
부모에 공통된 속성을 두어 코드 유지보수 용이하게함