This is a mirror of official site: http://jasper-net.blogspot.com/

Python beginner's mistakes

| Thursday, January 20, 2011
Every Python programmer had to learn the language at one time, and started out as a beginner. Beginners make mistakes. This article highlights a few common mistakes, including some I made myself.

Beginner's mistakes are not Python's fault, nor the beginner's. They're merely a result of misunderstanding the language. However, there is a difference between misunderstanding (often subtle) language features, vs misunderstanding the language as a whole, and what can (and cannot) be done with it. The pitfalls article focused on the former; this article deals with the latter.

To put it another way, the mistakes in this article are often cases of "the wrong tool for the job", rather than coding errors or sneaky language traps.

Mistake 1: trying to do low-level operations

Python is sometimes described as a VHLL, a Very High-Level Language. As such, it is naturally suited for high-level tasks, like generating or parsing HTML pages, scripting a game engine, or writing web frameworks, to name a few examples. It is not so suitable for tasks typically done by low-level languages, like writing device drivers, or tasks where performance is critical, like rendering of 3D graphics, or serious number-crunching.

This doesn't mean that it isn't possible to do these things with Python; but it's probably just not the right language for these jobs. One way to work around this is to write the low-level code in C, then have Python call it.


Mistake 2: writing "language X" code in Python

This is a mistake that is almost unavoidable. You come from, say, Pascal, and try your hand at Python. The first code you write will probably look like Pascal with a Python syntax. You are writing Pascal code in Python.

Some notorious symptoms of "language X" code, and the languages that may cause them:

  • You're really paranoid about data hiding (some would call this "encapsulation"), and/or write getters and setters for all object attributes, no matter whether they add special rules or not. (Java, C++, Delphi)
  • You overuse properties (one of the shiny new features in Python 2.2). (Java, Delphi, maybe Visual Basic, C++?)

Read more: Python beginner's mistakes

Posted via email from Jasper-net

31 comments:

Anonymous said...

Incredible! This blog looks just like my old one!
It's on a totally different topic but it has pretty much the same layout and design. Excellent choice of colors!

My webpage: haare dünner
my webpage > Haarwuchs

Anonymous said...

buy tramadol online tramadol hcl 50 mg tablets used - order tramadol europe

Anonymous said...

xanax online xanax schedule 2 drug - type drug xanax valium

Anonymous said...

buy tramadol online buy tramadol no prescription online - tramadol addiction nhs

Anonymous said...

buy tramadol online buy tramadol with american express - tramadol dosage pain dogs

Anonymous said...

xanax online xanax drug test job - order xanax online no prescription

Anonymous said...

buy tramadol online tramadol withdrawal day 8 - how to buy tramadol online overnight

Anonymous said...

cheap tramadol online tramadol 50 mg vs oxycodone 30 mg - kind high tramadol

Anonymous said...

buy carisoprodol soma carisoprodol dosage - carisoprodol 350 mg codeine

Anonymous said...

buy tramadol online tramadol 50 mg snorting - could you overdose tramadol

Anonymous said...

buy tramadol online tramadol sr tablet 100mg - tramadol for dogs addictive

Anonymous said...

buy tramadol online soma tramadol high - tramadol online for cheap

Anonymous said...

buy tramadol online beat tramadol addiction - what is tramadol addiction

Anonymous said...

buy tramadol online tramadol overnight no prescription mastercard - can take 3 50 mg tramadol

Anonymous said...

xanax online dosage for xanax for anxiety - xanax 2mg alprazolam

Anonymous said...

My developer is trying to persuade me to move to .
net from PHP. I have always disliked the idea because of the expenses.

But he's tryiong none the less. I've been using
Movable-type on several websites for about a year and am worried about switching to another
platform. I have heard great things about blogengine.net.
Is there a way I can import all my wordpress content into
it? Any help would be greatly appreciated!

Check out my web site; barcode scanner repair

Anonymous said...

xanax online how to pass a drug test in 24 hours + xanax - xanax dosage muscle spasm

Anonymous said...

Hi, its fastidious piece of writing regarding media print,
we all be familiar with media is a great source of information.


Also visit my site ... motorola scanner repair
Also see my web page :: psc barcode scanner repair

Anonymous said...

buy cialis from canada reviews on cialis vs. viagra - buy cialis online ireland

Anonymous said...

http://landvoicelearning.com/#74967 tramadol drug buyers - tramadol extended release 100 mg

Anonymous said...

tramadol online tramadol canadian pharmacy no prescription - tramadol online

Anonymous said...

http://buytramadolonlinecool.com/#28875 tramadol withdrawal while pregnant - safe take 2 50mg tramadol

Anonymous said...

buy tramadol tramadol dosage bluelight - tramadol 50 mg extended release

Anonymous said...

http://buytramadolonlinecool.com/#96430 tramadol for dogs dosage usa - tramadol no prescription overnight cod delivery

Anonymous said...

http://blog.dawn.com/dblog/buy/#blog tramadol hcl 30 mg - tramadol overnight shipping cod

Anonymous said...

cheap ativan buy lorazepam online no prescription needed - what is ativan high like

Anonymous said...

buy tramadol cod online order tramadol online us pharmacy - tramadol hcl 50 mg generic ultram

Anonymous said...

Oh my goodness! Impressive article dude!

Many thanks, However I am experiencing troubles with your RSS.
I don't know why I cannot subscribe to it. Is there anybody else getting identical RSS problems? Anyone who knows the answer will you kindly respond? Thanx!!

Feel free to surf to my web site; Recover Twitter Account

Anonymous said...

So from your Severe Love Spells of advertising your soul
to conjuring up state of mind to aid http://h2u.hartlake.org/groups/blakessciencepage/wiki/2de9d/How_to_Get_Your_Ex_Back__About_three_Methods_For_Success_and_three_Items_to_Avoid.html on two separate pieces of orange-coloured papers.
[url=http://www.nastyville.eu/help/index.php?title=Will_My_Ex_lover_Revisit_Relationship_Advice_Online_That_Will_Make_Your_Ex_Come_Back_to_You]how to
get your ex boyfriend back[/url] The Way To Get He Or She
Boyfriend show you this. For many have confidence in is simply challenging to obtain http:
//metrodetroitsalsa.com/index.php?option=com_blog&view=comments&pid=194849&Itemid=0 countless men and women think that
there's nevertheless desire to enable them to conserve their partnership.

Also visit my site; how to get your ex girlfriend back

Anonymous said...

Great delivery. Solid arguments. Keep up the good effort.


Here is my blog ... password hacking software

Anonymous said...

This program is intended to recover lost passwords for RAR/WinRAR archives of versions 2.
xx and 3.xx. http://www.passwordrecoveryforrar.
tk The free professional solution for recovering lost passwords to RAR
and WinRAR archives.

I really love your blog.. Pleasant colors & theme.
Did you build this web site yourself? Please reply back
as I'm wanting to create my very own blog and would like to find out where you got this from or what the theme is called. Many thanks!