TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do I make the transition from being a Python beginner?

20 点作者 mfieldhouse将近 14 年前
I've learnt all the basics of Python, the data types, functions, classes and iteration.<p>I've started a project to create Breakout using pygame.<p>I'm done with Learn Python the Hard Way and the other basic tutorials and need to know why you make certain things classes, when to create functions, how should the program be designed, how should it flow and so on. Ideally according to best practices.<p>I feel like I have all the pieces of Python but don't know how to start putting them together to make something that works.<p>Any advice?

11 条评论

veyron将近 14 年前
Build a small project and start working up.<p>Here's a simple example, and I and some of my compatriots would be willing to pay for someone to build, maintain, and possibly open-source it:<p>Build a parser that can read logs in the NASDAQ OUCH 4.1 format (<a href="http://www.nasdaqtrader.com/content/technicalsupport/specifications/TradingProducts/ouch4.1.pdf" rel="nofollow">http://www.nasdaqtrader.com/content/technicalsupport/specifi...</a>) and generate compliance logs. One example is OATS format (<a href="http://www.finra.org/Industry/Compliance/MarketTransparency/OATS/TechnicalSpecifications/" rel="nofollow">http://www.finra.org/Industry/Compliance/MarketTransparency/...</a>). I currently use a unmaintainable perl regex-happy monstrosity, and would like a clean python version with which I could quickly make changes.<p>The python workflow should be straightforward and this should not require any esoteric or nonstandard module (but since this is a learning exercise, I won't spoil it)
评论 #2820413 未加载
diminium将近 14 年前
Playing around with projects and making stuff is a good start.<p>Here's a warning though. Doing a lot of projects will help but be careful in considering this as a silver bullet. You will probably pick up some bad habits as well as future stuff people will go crazy over.<p>I would try to do something that involves working with other people. You'll probably have a headache, have an awful time at first but it will teach you a big lesson - how to structure your code in a way that it's more a diplomat that plays nicely with other people's code rather than a war mine that nobody wants to touch with a 1000 foot poll! Once you done that, then choose something in a completely different area (e.g. if you did client-server, try UI desktop application as an example). It doesn't have to be a big project but it will teach you how things can be similar and different.<p>So in short, solo projects then find your way into a team project of some type.<p>Just my two cents. Take what's useful and throwaway what you think is bad.
aorshan将近 14 年前
I'm in exactly the same boat you are. I recently finished one book and am now mostly finished with LPTHW. I feel like I have some of the basics down but I don't really know what to do next. It feels like there is this big gap and I don't know how to cross it.
stonemetal将近 14 年前
Unfortunately after you get past the basic learn a language stage, it more or less dries up. There are a couple of books that are polarizing like Design Patterns, but that is about it. From here on out it is trial and error.<p>As far as best practices go here is my list:<p>Automate everything you can.<p>Keep it coherent.<p>Rewrite when you find yourself building a house of cards.<p>When to create a function: anytime something is complicated enough that you think about it abstractly, anytime you use something more than once.<p>When to create a class: I haven't really nailed down a logical description for how or why I would make a class. Anytime you have a conceptual entity you have a candidate for a class, a player, a socket, a button, a window, a file.
mixmastamyk将近 14 年前
Dive into Python has several chapters on test driven development, refactoring, and performance tuning.<p>I'd also read some of the best books in general development if you haven't already: <a href="http://www.codinghorror.com/blog/2004/02/recommended-reading-for-developers.html" rel="nofollow">http://www.codinghorror.com/blog/2004/02/recommended-reading...</a> Also learn about the SDLC. Applies to every language.<p>Next, dig deep into the source of a large well-maintained projects such as Django or perhaps pygame. Learn mercurial, and start contributing via bitbucket, github, etc.<p>Find the right project and you should get valuable feedback for your efforts. ;)
评论 #2840485 未加载
vnchr将近 14 年前
Cristina (Crista) Videira Lopes started a list of programming or programming-related tasks like this: <a href="http://tagide.com/blog/2011/06/things-ics-students-should-do-before-graduating/" rel="nofollow">http://tagide.com/blog/2011/06/things-ics-students-should-do...</a><p>I'm in the same boat. On section 28 of LPTHW. Luckily, I am working with a startup where I hope to cut my teeth helping more with building our product instead of just being a customer guy. I promise to follow up when I get a better answer. Feel free to contact me.
civilian将近 14 年前
+1 for more projects. You also might try refactoring projects you already have, it's a good learning process.<p>I found projecteuler.net to be a really good source for tough programming/math problems. If you want a never-ending supply of puzzles, that's a good place to go. When I was first learning Python, my classmate &#38; I challenged eachother to see who could do problems 1-50 first. (It took us about a month-- we were also working full time and taking night classes. My classmate finished his 50th a few hours after me.)
redstar504将近 14 年前
Keep working on real projects and experimenting. Only so much knowledge can come from reading. You should also try dissecting some open source projects.
doublesprout将近 14 年前
"don't know how to start putting them together to make something that works"...try a Github search?<p>Design patterns is a great next step, but it sounds like you're not quite there yet. Something intermediate-level like Dive Into Python will give you more ideas.<p>I made apps with WxWidgets and Django after learning the basics, but there are a million directions to go in. They just all involve building things and learning as you go.
chulipuli将近 14 年前
for i in range(1, 1000): print "Do a project.\n"<p>I know this is rather rude, but doing projects is the only way to learn.<p>Take it from me, someone who wasted a lot of time trying making it click by study alone.
belial将近 14 年前
I would recommend you check this online book: <a href="http://htdp.org/" rel="nofollow">http://htdp.org/</a><p>"How to Design Programs" is a great resource for newcommers and professionals alike. It's a good revision and a good start.<p>Enjoy.