rvitinn

Hravirkari Python ki

Nokkrar fnar bendingar fyrir Python forritara. Nokkur atrii arna sem g hef ekki sp , t.d. biset og a "while 1" s hravirkara en "while True"!

Python Performance Tips, Part 1

No question about it: Python program does not run as fast or efficiently as compiled languages. Even Python advocates will tell you performance is the area that Python is not good for. However, YouTube has proven Python is capable of serving 40 million videos per hour. All you have to do is writing efficient code and seek external (C/C++) implementation for speed if needed. Here are the tips to help you become a better Python developer

(via reddit)

python
Athugasemdir

Matti - 14/02/12 10:08 #

Varandi while True/1

In Python 3, True is a keyword, not a built-in. That means the byte code compiler can put in a cheap simple jump instead of an expensive global lookup. In Python 2, True could be changed, so a global lookup was required as a check. 1 is a constant, so the bytecode compiler can depend on it. Basically: while 1 in Python 2, while True in Python 3. #

Matti - 14/02/12 15:04 #

Tja, g hef a.m.k. aldrei nota Python 3 og s ekki fram a gera a nstunni.

Matti - 14/02/12 20:17 #

umrunum reddit er komin nokku hr gagnrni greinina, sumt henni stenst ekki nnari skoun.

Valgarur Gujnsson - 15/02/12 00:23 #

Fyrir (allt of) mrgum rum s g setningu eim ntum a ef tlair a rkra forritunarml vri betra a byrja einhverju auveldu, eins og til dmis trmlum.

Er etta merki ess a srt orinn leiur (tskrifaur?) trmlunum?

Matti - 15/02/12 07:35 #

a m hugsanlega draga lyktun :-)

Annars tlai g ekkert a rkra, etta tti a vera mjg jkvtt innlegg umruna. Reyndar skimai g bara greinina ur en g setti inn vsun. Svo kemur ljs a a eru nokkrar furulegar fullyringar henni.

Nonni - 15/02/12 22:19 #

Hvort sem etta er rtt ea ekki, finnst mr a flk tti a hafa a sem fallegar reynist egar a skrifar Pythonka. Ef hrai skiptir mli droppar maur niur cython, psycho ea bara lti stt c-library.

Matti - 15/02/12 23:37 #

Alveg rtt grundvallaratrium. g hef stundum n mjg mikilli hraaaukningu me v a endurskrifa Python ka, yfirleitt eftir flk sem kunni lti Python .a. kinn var lka lsilegri vi endurskrift/refactoring.

Erlendur - 16/02/12 13:45 #

g ver a viurkenna a g nota eina umalputtareglu egar g skrifa Python, etta a vera fallegur ki. Hrai er eitthva sem skiptir engu mli hj mr. a gti tengst v a allur Python ki sem g skrifa er til ess a greina niurstur sem fst t r lngum keyrslum r FORTRAN forritum ;)

Reyndar hjlpar eitthva a a sem mr finnst vera fallegt er mjg hravirkt Python, e. list comprehension og svoleiis skemmtilegheit.