맛보기 — 눌러서 들어 보세요A taste — tap to hear it
맛보기는 앞 두 장입니다. 모든 장은 책에 있습니다.
-
파이썬paisseon
python파이싼
읽기 쉬운 글꼴로 적고 바로 돌려 보는 프로그래밍 언어A programming language you write in readable form and run right away
파이썬은 적은 줄로 많은 일을 한다.Python does a lot in few lines.
-
인터프리터inteopeuriteo
interpreter인터프러터
적어 둔 코드를 한 줄씩 읽어 그대로 돌리는 프로그램The program that reads your code and runs it as it goes
인터프리터가 파일을 위에서 아래로 읽는다.The interpreter reads the file from top to bottom.
-
대화형 셸daehwahyeong syel
repl레플
한 줄 적으면 바로 답을 보여 주는 창A window that answers each line as soon as you type it
대화형 셸에서 한 줄씩 시험해 본다.Try it line by line in the interactive shell.
-
프롬프트peurompeuteu
prompt프람프트
이제 적으라고 기다리며 떠 있는 표시The mark that sits waiting for you to type
프롬프트가 보이면 이제 적어도 된다.When the prompt shows, you can type.
-
스크립트seukeuripteu
script스크립트
파일에 적어 두고 한 번에 돌리는 코드Code written in a file and run in one go
스크립트로 적어 두면 다시 돌리기 쉽다.Written as a script, it is easy to run again.
-
모듈 파일modyul pail
module file마줄 퐈일
파이썬 코드를 담은 파일 하나 — 끝이 .py 이다One file holding Python code; its name ends in .py
모듈 파일 하나에 관련된 함수를 모아 둔다.Related functions go in one module file.
-
실행silhaeng
run런
적어 둔 코드를 인터프리터에게 넘겨 돌게 하기Handing your code to the interpreter so it goes
고친 뒤에 다시 실행해 본다.Run it again after the change.
-
들여쓰기deuryeosseugi
indentation인덴테이션
줄 앞의 빈칸 — 파이썬에서는 묶음을 나누는 문법이다The blank space in front of a line; in Python it is the grammar that groups lines
들여쓰기가 틀리면 묶음이 달라진다.Wrong indentation makes a different block.
-
공백gongbaek
whitespace와잇스페이스
빈칸·탭·줄바꿈처럼 눈에 보이지 않는 글자Characters you cannot see: space, tab, line break
공백은 눈에 안 보여도 뜻이 있다.White space is invisible but means something.
-
콜론kollon
colon코울런
묶음이 여기서 시작한다고 알리는 쌍점The two-dot mark saying a block starts here
콜론 뒤부터 들여쓴 줄이 묶음이다.The indented lines after the colon are the block.
-
주석juseok
comment카멘트
사람만 읽는 줄 — 샵 뒤는 돌지 않는다A line only people read; after a hash nothing runs
왜 그렇게 했는지를 주석에 적는다.Write why you did it that way in a comment.
-
출력 함수chullyeok hamsu
print프린트
값을 화면에 찍어 주는 내장 함수The built-in function that prints a value to the screen
값이 어떻게 나오는지 출력 함수로 본다.Use print to see how a value comes out.
-
입력 함수imnyeok hamsu
input인풋
사람이 친 글을 문자열로 받아 오는 내장 함수The built-in function that takes what a person types, as text
입력 함수로 받은 것은 언제나 문자열이다.What input gives back is always text.
-
문법 에러munbeop ereo
syntax error신택스 에러
글꼴이 틀려서 돌기도 전에 멈추는 잘못A mistake in the writing itself, so nothing runs at all
콜론을 빼먹어 문법 에러가 났다.A missing colon raised a syntax error.
-
들여쓰기 에러deuryeosseugi ereo
indentationerror인덴테이션에러
들여쓰기가 어긋나 묶음을 못 읽을 때 나는 문법 에러The syntax error raised when the indentation does not line up
한 줄만 빈칸이 달라도 들여쓰기 에러가 난다.One line with different spacing raises an indentation error.
-
에러 메시지ereo mesiji
error message에러 메서지
무엇이 어디서 왜 틀렸는지 알려 주는 글The text that says what went wrong, where, and why
에러 메시지 첫 줄과 끝 줄을 먼저 읽는다.Read the first and last line of the error message first.
-
트레이스백teureiseubaek
traceback트레이스백
멈춘 자리까지 거쳐 온 함수 목록 — 맨 아래가 멈춘 곳이다The list of calls the program came through; the bottom line is where it stopped
트레이스백은 아래에서 위로 읽는다.Read a traceback from the bottom up.
-
줄 번호jul beonho
line number을라인 넘버
에러가 가리키는 파일 속 줄의 번호The number of the line in the file that the error points at
줄 번호로 가서 그 줄을 본다.Go to the line number and look at that line.
-
도움말 함수doummal hamsu
help헬프
그 자리에서 함수·객체의 설명을 꺼내 보는 내장 함수The built-in function that shows an object's own explanation on the spot
도움말 함수로 무엇을 할 수 있는지 본다.Use help to see what it can do.
-
나가기nagagi
exit에그짓
대화형 셸을 닫고 돌아 나오기Closing the interactive shell and coming back out
나가기로 대화형 셸을 닫는다.Leave the interactive shell with exit.
-
인터프리터 언어inteopeuriteo eoneo
interpreted language인터프러티드 을랭궈지
미리 기계어로 옮겨 두지 않고 그때그때 읽어 돌리는 언어A language read and run as it goes, not translated to machine code beforehand
인터프리터 언어는 고치고 바로 돌려 보기 쉽다.An interpreted language is easy to change and run at once.
-
바이트 코드baiteu kodeu
bytecode바잇코우드
인터프리터가 읽기 좋게 한 번 옮겨 둔 중간 꼴The middle form the interpreter translates your code into once
바이트 코드는 사람이 읽으려고 만든 것이 아니다.Bytecode is not made for people to read.
-
동적 타이핑dongjeok taiping
dynamic typing다이내믹 타이핑
값의 형을 돌면서 따지는 방식 — 이름에는 형을 붙이지 않는다Checking the type of a value while running; names carry no type
동적 타이핑이라 같은 이름에 다른 형을 담을 수 있다.With dynamic typing one name can hold another type.
-
덕 타이핑deok taiping
duck typing덕 타이핑
무슨 형인지 묻지 않고 필요한 메서드가 있나만 보는 방식Not asking what type it is, only whether it has the method you need
덕 타이핑에서는 읽을 수만 있으면 파일처럼 쓸 수 있다.Under duck typing, anything readable can act as a file.
-
강한 타이핑ganghan taiping
strong typing스트롱 타이핑
형이 다른 값을 몰래 섞어 주지 않는 성질 — 숫자와 문자열은 더해지지 않는다Not quietly mixing values of different types; a number and a string will not add
강한 타이핑이라 수와 문자열을 더하면 멈춘다.With strong typing, adding a number to text stops.
-
가독성gadokseong
readability리더빌리티
코드를 사람이 얼마나 쉽게 읽나 — 파이썬이 가장 앞세우는 것How easily a person reads the code; what Python puts first
가독성이 좋으면 몇 달 뒤 내가 읽기 쉽다.Good readability means you can read it months later.
-
표준 라이브러리pyojun raibeureori
standard library스탠더드 을라이브레리
파이썬을 깔면 함께 들어오는 모듈 묶음The set of modules that comes with Python itself
표준 라이브러리만으로 되는 일이 아주 많다.A great deal is already possible with the standard library alone.
-
건전지 포함geonjeonji poham
batteries included배터리즈 인클루디드
흔한 일은 표준 라이브러리로 이미 된다는 말The saying that common jobs are already done in the standard library
건전지 포함이라 날짜·파일·그물은 이미 들어 있다.Batteries included: dates, files and networks are already there.
-
크로스 플랫폼keuroseu peullaetpom
cross-platform크로스-플랫푐
같은 코드가 다른 운영체제에서도 그대로 도는 것The same code running on other operating systems as it is
크로스 플랫폼이라 같은 코드가 다른 운영체제에서도 돈다.Being cross-platform, the same code runs on another operating system.
-
명세myeongse
specification스페시퓌케이션
언어가 무엇을 어떻게 해야 하는지 글로 못 박아 둔 것What the language must do, pinned down in writing
명세가 있으니 다른 구현도 같은 뜻으로 돈다.With a specification, another implementation runs with the same meaning.
-
PEP (개선 제안서)PEP
pep펩
언어를 바꾸는 제안과 결정을 적어 둔 번호 붙은 문서The numbered documents holding proposals and decisions about the language
왜 그렇게 정했는지는 PEP 에 적혀 있다.Why it was decided that way is written in a PEP.
-
CPythonCPython
cpython씨파이썬
우리가 보통 쓰는 파이썬 — C 로 만든 구현The Python we normally use: the implementation written in C
우리가 깔아 쓰는 것이 보통 CPython 이다.What we install is usually CPython.
-
참조 구현chamjo guhyeon
reference implementation레풔런스 임플러멘테이션
다른 구현이 기준으로 삼는 바로 그 구현The implementation others take as the standard to match
참조 구현과 다르면 그쪽을 고친다.What differs from the reference implementation is what gets fixed.
-
파이썬의 선paisseonui seon
zen of python젠 어븨 파이싼
쉬운 쪽·드러난 쪽·하나의 길을 고르라는 짧은 지침 모음A short set of guidelines: prefer the simple, the explicit, the one way
파이썬의 선은 드러난 쪽을 고르라고 한다.The Zen of Python says to prefer the explicit.
-
전역 인터프리터 락jeonyeok inteopeuriteo rak
global interpreter lock글로우블 인터프러터 을락
한 번에 한 스레드만 바이트 코드를 돌게 하는 자물쇠The lock that lets only one thread run bytecode at a time
전역 인터프리터 락 때문에 스레드를 늘려도 셈이 빨라지지 않는다.Because of the global interpreter lock, more threads do not make arithmetic faster.
-
버전beojeon
version붜전
언어의 판 — 앞 숫자가 바뀌면 달라지는 것이 많다A release of the language; much changes when the leading number does
버전을 적어 두면 다음에도 같게 돈다.Writing the version down keeps the next run the same.
-
하위 호환성hawi hohwanseong
backward compatibility배쿼드 컴패터빌러티
새 판에서도 옛 코드가 그대로 도는 것Old code still running on a new release
하위 호환성이 있어 옛 코드가 새 판에서도 돈다.With backward compatibility, old code runs on the new release.
-
성능seongneung
performance퍼푀먼스
같은 일을 얼마나 빨리, 얼마나 적은 메모리로 하나How fast and with how little memory the same work gets done
성능은 재 보고 말한다.Speak about performance only after measuring.
-
절충 (맞바꿈)jeolchung
trade-off트레이드-오픠
하나를 얻으려고 다른 하나를 내주는 일Giving up one thing to get another
읽기 쉬움과 빠름 사이의 절충이다.It is a trade-off between being readable and being fast.
-
생태계saengtaegye
ecosystem이코시스텀
언어 바깥에 쌓인 꾸러미·문서·사람들 전체Everything built around a language: packages, documents, people
생태계가 넓어도 밑천은 표준 라이브러리다.However wide the ecosystem, the base is the standard library.
-
Q파이썬을 어떻게 돌려?paisseoneul eotteoke dollyeo?How do I run Python?하우 두 아이 런 파이싼
A파일에 적어 두고 파이썬에게 그 파일을 넘기면 돼.paire jeogeo dugo paisseonege geu paireul neomgimyeon dwae.Write it in a file and hand that file to Python.라잇 잇 인 어 퐈일 앤드 핸드 됏 퐈일 투 파이싼
-
Q한 줄만 시험해 보고 싶어.han julman siheomhae bogo sipeo.I want to try just one line.아이 완트 투 트라이 저스트 원 을라인
A대화형 셸을 열어. 적으면 바로 답을 보여 줘.daehwahyeong syereul yeoreo. jeogeumyeon baro dabeul boyeo jwo.Open the interactive shell: it answers as soon as you type.오우픈 둬 인터랙티븨 셸 잇 앤서즈 애즈 순 애즈 유 타이프
-
Q들여쓰기가 왜 그렇게 중요해?deuryeosseugiga wae geureoke jungyohae?Why does indentation matter so much?와이 더즈 인덴테이션 매터 소우 머치
A다른 언어의 중괄호 자리야. 빈칸이 묶음을 가르거든.dareun eoneoui junggwalho jariya. binkani mukkeumeul gareugeodeun.It is where other languages put braces: the spacing divides the blocks.잇 이즈 웨어 어둬 을랭궈지즈 풋 브레이시즈 둬 스페이싱 디봐이즈 둬 블락스
-
Q빈칸과 탭을 섞어도 돼?binkangwa taebeul seokkeodo dwae?Can I mix spaces and tabs?캔 아이 믹스 스페이시즈 앤드 태브즈
A안 돼. 눈에는 같아 보여도 들여쓰기 에러가 나. 빈칸 넷으로 통일해.an dwae. nuneneun gata boyeodo deuryeosseugi ereoga na. binkan neseuro tongilhae.No. They look the same but raise an indentation error; settle on four spaces.노우 뒈이 을룩 둬 세임 벗 레이즈 앤 인덴테이션 에러 세틀 안 푀 스페이시즈
-
Q에러가 났는데 뭘 먼저 봐?ereoga nanneunde mwol meonjeo bwa?An error came up. What do I look at first?앤 에러 케임 업 왓 두 아이 을룩 앳 풔스트
A트레이스백의 맨 아래 줄을 봐. 거기가 멈춘 곳이고 그 위는 거쳐 온 길이야.teureiseubaegui maen arae jureul bwa. geogiga meomchun gosigo geu wineun geochyeo on giriya.Read the bottom line of the traceback: that is where it stopped, and above it is the path it came through.레드 둬 바텀 을라인 어븨 둬 트레이스백 됏 이즈 웨어 잇 스탑트 앤드 어버븨 잇 이즈 둬 패쓰 잇 케임 쓰루
-
Q줄 번호가 가리킨 줄이 멀쩡해.jul beonhoga garikin juri meoljjeonghae.The line the number points at looks fine.둬 을라인 둬 넘버 포인츠 앳 을룩스 퐈인
A그 위 줄에서 괄호나 여는 부호를 안 닫았을 때가 많아.geu wi jureseo gwalhona yeoneun buhoreul an dadasseul ttaega mana.Often a bracket or an opening mark on the line above was never closed.오픤 어 브래킷 오 앤 오우퍼닝 마크 안 둬 을라인 어버븨 워즈 네붜 클로우즈드
-
Q이 함수가 뭘 하는지 그 자리에서 보고 싶어.i hamsuga mwol haneunji geu jarieseo bogo sipeo.I want to see what this function does, right here.아이 완트 투 시 왓 뒤스 풩크션 더즈 라잇 히어
A도움말 함수에 넣어 봐. 그 안의 설명이 그대로 나와.doummal hamsue neoeo bwa. geu anui seolmyeongi geudaero nawa.Put it in help: its own explanation comes out as it is.풋 잇 인 헬프 잇츠 온 엑스플러네이션 컴즈 아웃 애즈 잇 이즈
-
Q주석은 뭘 적어?juseogeun mwol jeogeo?What goes in a comment?왓 고우즈 인 어 카멘트
A무엇을 하는지는 코드가 말해. 주석에는 왜 그렇게 했는지를 적어.mueoseul haneunjineun kodeuga malhae. juseogeneun wae geureoke haenneunjireul jeogeo.The code says what it does; the comment says why it was done that way.둬 코우드 세즈 왓 잇 더즈 둬 카멘트 세즈 와이 잇 워즈 던 됏 웨이
-
QAI 가 코드를 줬어. 사람이 먼저 할 일은?AI ga kodeureul jwosseo. sarami meonjeo hal ireun?AI handed me code. What does a person do first?에이아이 핸디드 미 코우드 왓 더즈 어 퍼슨 두 풔스트
A무엇을 만들려 했는지 다시 읽고, 돌려 보고, 나온 글이 바란 것과 같은지 본다.mueoseul mandeullyeo haenneunji dasi ikgo, dollyeo bogo, naon geuri baran geotgwa gateunji bonda.Read again what it was meant to do, run it, and see whether the output matches.레드 어겐 왓 잇 워즈 멘트 투 두 런 잇 앤드 시 웨둬 둬 아웃풋 매치즈
-
QAI 가 「됩니다」라고만 해.AI ga 「doemnida」ragoman hae.AI just says 'it works'.에이아이 저스트 세즈 잇 워크스
A무엇으로 확인했는지 묻는다. 돌린 명령과 나온 글을 보여 달라고 한다.mueoseuro hwaginhaenneunji munneunda. dollin myeongnyeonggwa naon geureul boyeo dallago handa.Ask what confirmed it: have it show the command it ran and the output.애스크 왓 컨풤드 잇 해븨 잇 쇼우 둬 커맨드 잇 랜 앤드 둬 아웃풋
-
Q처음 보는 명령을 시켜.cheoeum boneun myeongnyeongeul sikyeo.It tells me to run a command I do not know.잇 텔즈 미 투 런 어 커맨드 아이 두 낫 노우
A무엇을 바꾸는 명령인지 먼저 묻는다. 지우거나 덮는 명령이면 더 그렇다.mueoseul bakkuneun myeongnyeonginji meonjeo munneunda. jiugeona deomneun myeongnyeongimyeon deo geureota.Ask what the command changes first, especially if it deletes or overwrites.애스크 왓 둬 커맨드 체인지즈 풔스트 어스페시리 이픠 잇 딜릿츠 오 오우붜라잇츠
-
Q에러를 보여 줬더니 코드를 다 다시 썼어.ereoreul boyeo jwotdeoni kodeureul da dasi sseosseo.I showed it an error and it rewrote the whole thing.아이 쇼우드 잇 앤 에러 앤드 잇 리로우트 둬 호울 씽
A그 에러 한 줄만 고치라고 다시 부탁한다. 크게 바뀌면 무엇이 달라졌는지 못 본다.geu ereo han julman gochirago dasi butakanda. keuge bakkwimyeon mueosi dallajyeonneunji mot bonda.Ask again to fix just that one error; a big rewrite hides what changed.애스크 어겐 투 퓍스 저스트 됏 원 에러 어 비그 리라잇 하이즈 왓 체인지드
차례 — 17장Contents — 17 chapters
- 0처음Getting Started
- 1파이썬을 왜 고르나Why Python
- 2값과 타입Values and Types
- 3변수와 이름Variables and Names
- 4글자Text
- 5리스트와 튜플Lists and Tuples
- 6딕셔너리와 집합Dictionaries and Sets
- 7흐름Flow
- 8함수Functions
- 9모듈과 패키지Modules and Packages
- 10클래스와 객체Classes and Objects
- 11예외 처리Handling Exceptions
- 12파일과 경로Files and Paths
- 13반복자와 제너레이터Iterators and Generators
- 14타입 힌트Type Hints
- 15시험과 디버깅Tests and Debugging
- 16환경·내보내기·AI 와Environments, Shipping, and Working with AI