Programing

Python 진행 경로-견습생에서 전문가로

lottogame 2020. 10. 2. 21:22
반응형

Python 진행 경로-견습생에서 전문가로


저는 지금 1 년 반 동안 파이썬을 배우고, 일하고, 놀고 있습니다. 생물 학자로서 천천히 생물 정보학으로 전환하는이 언어는 제가 실험실에서 만든 모든 주요 공헌의 핵심이었습니다. 저는 파이썬이 제가 아름다운 솔루션을 표현할 수 있도록 허용하는 방식과 생각에서 실행 가능한 코드로의 자연스러운 흐름을 허용하는 언어의 의미에 어느 정도 사랑에 빠졌습니다.

제가 알고 싶은 것은이 포럼이나 다른 포럼에서 거의 본 적이없는 질문에 대한 귀하의 답변입니다. 이 질문은 Python 개선의 길에 있지만 그의 다음 단계가 무엇인지 궁금해하는 사람에게는 나에게 핵심적인 것처럼 보입니다.

내가 먼저 묻고 싶지 않은 것을 요약하겠습니다.)

  • Python을 빠르게 배우는 방법을 알고 싶지 않습니다.
  • 언어에 익숙해지는 가장 좋은 방법을 찾고 싶지도 않습니다.
  • 마지막으로, '모든 것을 처리하는 하나의 트릭'접근 방식을 알고 싶지 않습니다.

내가 당신의 의견을 알고 싶은 것은 :

한 번에 한 단계 씩 지속적으로 향상되고 더 나은 Python 코더가되기 위해 견습생에서 전문가 지위 (전문가가 지시하는 곳에서 자유롭게 중지 할 수 있음)에 이르기까지 Python 숙련자에게 권장 할 단계는 무엇입니까? SO의 일부 사람들은 거의 Python 실력으로 숭배 할 가치가있는 것처럼 보입니다.

내가 즐길 수있는 답변의 종류는 (하지만 독자층을 놀라게하여 주시기 바랍니다. : P), 다소 형식이 다음과 같습니다.

  • 이것을 읽고 (예 : 파이썬 튜토리얼), 그런 종류의 세부 사항에주의를 기울이십시오.
  • 너무 많은 시간 / 문제 / 코드 줄에 대한 코드
  • 그런 다음이 책을 읽으십시오 (예 :이 책 또는 저 책). 이번에는
  • 몇 가지 실제 문제 해결
  • 그런 다음 Y를 읽으십시오.
  • 이러한 개념을 이해해야합니다.
  • X 시간 용 코드
  • 그런 기본으로 돌아 오거나 더 나아가 ...
  • (당신은 요점을 얻습니다 :)

나는 지속적으로 발전하기 위해 다양한 단계에서 정확히 어떤 사람이주의를 기울여야하는지에 대한 당신의 의견을 아는 것에 정말로 관심이 있습니다. 특정 전문 분야에서 온 경우이 분야에서 적절하다고 생각되는 경로에 대해 논의하십시오.

편집 : 귀하의 훌륭한 의견 덕분에 저는 Python 개선 트랙으로 돌아 왔습니다! 정말 감사합니다!


파이썬 숙달 과정은 다음과 같이 진행되었다고 생각했습니다.

  1. 목록 이해력 발견
  2. 발전기 발견
  3. 통합하십시오 지도, 필터, ITER는, 범위, xrange 감소 코드에 자주
  4. 디스 커버 장식
  5. 재귀 함수 작성, 많이
  6. 발견의 itertoolsfunctools
  7. 읽기 실제 세계 하스켈 ( 무료 온라인 읽기 )
  8. 수많은 고차 함수, 재귀 등으로 모든 이전 Python 코드를 다시 작성하십시오.
  9. 큐비클 메이트가 Python 수업을 제공 할 때마다 귀찮게합니다. 사전과 일부 기능으로 "더 나은"구현이 가능하다고 주장하십시오. 함수형 프로그래밍을 받아들입니다.
  10. 전략 패턴을 재발견 한 다음 Haskell 이후에 잊으려고 애쓰는 명령형 코드에서 모든 것을 발견하십시오 .
  11. 균형을 찾으십시오.

Python 지식을 넓히는 한 가지 좋은 방법은 이미 사용중인 라이브러리, 플랫폼 및 프레임 워크의 소스 코드파헤치는 것입니다.

예를 들어 Django 에서 사이트를 구축하는 경우 문제가 될 수있는 많은 질문에 대해 Django가 해당 기능을 구현하는 방법을 살펴보면 답을 얻을 수 있습니다.

이렇게하면 새로운 관용구, 코딩 스타일 및 Python 트릭을 계속해서 익힐 수 있습니다. (일부는 좋을 것이고 일부는 나쁠 것입니다.)

소스에서 이해할 수없는 Pythony를 발견하면 #python IRC 채널 로 이동하면 많은 "언어 변호사"가 기꺼이 설명 할 수 있습니다.

An accumulation of these little clarifications over years leads to a much deeper understanding of the language and all of its ins and outs.


Understand (more deeply) Python's data types and their roles with regards to memory mgmt

As some of you in the community are aware, I teach Python courses, the most popular ones being the comprehensive Intro+Intermediate course as well as an "advanced" course which introduces a variety of areas of application development.

Quite often, I get asked a question quite similar to, "Should I take your intro or advanced course? I've already been programming Python for 1-2 years, and I think the intro one is too simple for me so I'd like to jump straight to the advanced... which course would you recommend?"

그들의 질문에 답하기 위해, 나는 그들이이 분야에서 얼마나 강한 지 조사합니다 .-- 그들이 어떤 고급 과정에 대한 준비가되었는지를 측정하는 가장 좋은 방법이 아니라 그들의 기본 지식이 파이썬의 객체와 메모리 모델은 초보자뿐만 아니라 그 이상을 경험 한 사람들이 작성한 많은 Python 버그 의 원인 입니다.

이를 위해 다음과 같은 간단한 2 부작 퀴즈 질문을 제시합니다. Ex1: x=42; y=x; x+=1; print x,y Ex2: x=[1,2,3];y=x;x[0]=4;print x,y

Many times, they are able to get the output, but the why is more difficult and much more important of an response... I would weigh the output as 20% of the answer while the "why" gets 80% credit. If they can't get the why, regardless how Python experience they have, I will always steer people to the comprehensive intro+intermediate course because I spend one lecture on objects and memory management to the point where you should be able to answer with the output and the why with sufficient confidence. (Just because you know Python's syntax after 1-2 years doesn't make you ready to move beyond a "beginner" label until you have a much better understanding as far as how Python works under the covers.)

A succeeding inquiry requiring a similar answer is even tougher, e.g.,

Example 3

x = ['foo', [1,2,3], 10.4]
y = list(x) # or x[:]
y[0] = 'fooooooo'
y[1][0] = 4
print x
print y

The next topics I recommend are to understanding reference counting well, learning what "interning" means (but not necessarily using it), learning about shallow and deep copies (as in Example 3 above), and finally, the interrelationships between the various types and constructs in the language, i.e. lists vs. tuples, dicts vs. sets, list comprehensions vs. generator expressions, iterators vs. generators, etc.; however all those other suggestions are another post for another time. Hope this helps in the meantime! :-)

ps. I agree with the other responses for getting more intimate with introspection as well as studying other projects' source code and add a strong "+1" to both suggestions!

pps. Great question BTW. I wish I was smart enough in the beginning to have asked something like this, but that was a long time ago, and now I'm trying to help others with my many years of full-time Python programming!!


Check out Peter Norvig's essay on becoming a master programmer in 10 years: http://norvig.com/21-days.html. I'd wager it holds true for any language.


Understand Introspection

  • write a dir() equivalent
  • write a type() equivalent
  • figure out how to "monkey-patch"
  • use the dis module to see how various language constructs work

Doing these things will

  • give you some good theoretical knowledge about how python is implemented
  • give you some good practical experience in lower-level programming
  • give you a good intuitive feel for python data structures

def apprentice():
  read(diveintopython)
  experiment(interpreter)
  read(python_tutorial)
  experiment(interpreter, modules/files)
  watch(pycon)

def master():
  refer(python-essential-reference)
  refer(PEPs/language reference)
  experiment()
  read(good_python_code) # Eg. twisted, other libraries
  write(basic_library)   # reinvent wheel and compare to existing wheels
  if have_interesting_ideas:
     give_talk(pycon)

def guru():
  pass # Not qualified to comment. Fix the GIL perhaps?

I'll give you the simplest and most effective piece of advice I think anybody could give you: code.

You can only be better at using a language (which implies understanding it) by coding. You have to actively enjoy coding, be inspired, ask questions, and find answers by yourself.

Got a an hour to spare? Write code that will reverse a string, and find out the most optimum solution. A free evening? Why not try some web-scraping. Read other peoples code. See how they do things. Ask yourself what you would do.

When I'm bored at my computer, I open my IDE and code-storm. I jot down ideas that sound interesting, and challenging. An URL shortener? Sure, I can do that. Oh, I learnt how to convert numbers from one base to another as a side effect!

This is valid whatever your skill level. You never stop learning. By actively coding in your spare time you will, with little additional effort, come to understand the language, and ultimately, become a guru. You will build up knowledge and reusable code and memorise idioms.


If you're in and using python for science (which it seems you are) part of that will be learning and understanding scientific libraries, for me these would be

  • numpy
  • scipy
  • matplotlib
  • mayavi/mlab
  • chaco
  • Cython

knowing how to use the right libraries and vectorize your code is essential for scientific computing.

I wanted to add that, handling large numeric datasets in common pythonic ways(object oriented approaches, lists, iterators) can be extremely inefficient. In scientific computing, it can be necessary to structure your code in ways that differ drastically from how most conventional python coders approach data.


Google just recently released an online Python class ("class" as in "a course of study").

http://code.google.com/edu/languages/google-python-class/

I know this doesn't answer your full question, but I think it's a great place to start!


Download Twisted and look at the source code. They employ some pretty advanced techniques.


Thoroughly Understand All Data Types and Structures

For every type and structure, write a series of demo programs that exercise every aspect of the type or data structure. If you do this, it might be worthwhile to blog notes on each one... it might be useful to lots of people!


I learned python first by myself over a summer just by doing the tutorial on the python site (sadly, I don't seem to be able to find that anymore, so I can't post a link).

Later, python was taught to me in one of my first year courses at university. In the summer that followed, I practiced with PythonChallenge and with problems from Google Code Jam. Solving these problems help from an algorithmic perspective as well as from the perspective of learning what Python can do as well as how to manipulate it to get the fullest out of python.

For similar reasons, I have heard that code golf works as well, but i have never tried it for myself.


Learning algorithms/maths/file IO/Pythonic optimisation

This won't get you guru-hood but to start out, try working through the Project Euler problems The first 50 or so shouldn't tax you if you have decent high-school mathematics and know how to Google. When you solve one you get into the forum where you can look through other people's solutions which will teach you even more. Be decent though and don't post up your solutions as the idea is to encourage people to work it out for themselves.

Forcing yourself to work in Python will be unforgiving if you use brute-force algorithms. This will teach you how to lay out large datasets in memory and access them efficiently with the fast language features such as dictionaries.

From doing this myself I learnt:

  • File IO
  • Algorithms and techniques such as Dynamic Programming
  • Python data layout
    • Dictionaries/hashmaps
    • Lists
    • Tuples
    • Various combinations thereof, e.g. dictionaries to lists of tuples
  • Generators
  • Recursive functions
  • Developing Python libraries
    • Filesystem layout
    • Reloading them during an interpreter session

And also very importantly

  • When to give up and use C or C++!

All of this should be relevant to Bioinformatics

Admittedly I didn't learn about the OOP features of Python from that experience.


Have you seen the book "Bioinformatics Programming using Python"? Looks like you're an exact member of its focus group.


You already have a lot of reading material, but if you can handle more, I recommend you learn about the evolution of python by reading the Python Enhancement Proposals, especially the "Finished" PEPs and the "Deferred, Abandoned, Withdrawn, and Rejected" PEPs.

By seeing how the language has changed, the decisions that were made and their rationales, you will absorb the philosophy of Python and understand how "idiomatic Python" comes about.

http://www.python.org/dev/peps/


Attempt http://challenge.greplin.com/ using Python


Teaching to someone else who is starting to learn Python is always a great way to get your ideas clear and sometimes, I usually get a lot of neat questions from students that have me to re-think conceptual things about Python.


Not precisely what you're asking for, but I think it's good advice.

Learn another language, doesn't matter too much which. Each language has it's own ideas and conventions that you can learn from. Learn about the differences in the languages and more importantly why they're different. Try a purely functional language like Haskell and see some of the benefits (and challenges) of functions free of side-effects. See how you can apply some of the things you learn from other languages to Python.


I recommend starting with something that forces you to explore the expressive power of the syntax. Python allows many different ways of writing the same functionality, but there is often a single most elegant and fastest approach. If you're used to the idioms of other languages, you might never otherwise find or accept these better ways. I spent a weekend trudging through the first 20 or so Project Euler problems and made a simple webapp with Django on Google App Engine. This will only take you from apprentice to novice, maybe, but you can then continue to making somewhat more advanced webapps and solve more advanced Project Euler problems. After a few months I went back and solved the first 20 PE problems from scratch in an hour instead of a weekend.

참고URL : https://stackoverflow.com/questions/2573135/python-progression-path-from-apprentice-to-guru

반응형