Today's Question:  What does your personal desk look like?        GIVE A SHOUT

SEARCH KEYWORD -- python



  Python: copying a list the right way

new = old[:] Those proficient in Python know what the previous line do. It copies the list old into new. This is confusing for beginners and should be avoided. Sadly the [:] notation is widely used, probably because most Python programmers don’t know a better way of copying lists.A little bit of pythonic theoryFirst we need to understand how Python manages objects & variables. Python doesn’t have variables like C. In C a variable is not just a name, it ...

   Python,List,Copy,Reference,[:],list()     2011-11-07 08:04:48

  Python Performance Tips, Part 1

To read the Zen of Python, type import this in your Python interpreter. A sharp reader new to Python will notice the word “interpreter”, and realize that Python is another scripting language. “It must be slow!” 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...

   Python,Performance,Efficiency,Tips     2012-02-14 10:50:22

  Learning Is More Important Than Knowing

Although DuckDuckGo's success is based more on ideology than technology, you'd have to be a pretty arrogant technologist to not appreciate and be impressed with what this small team (for a long time, 1 person) has accomplished. And while DuckDuckGo teaches us a number of valuable lessons (about business, and privacy), to me, the most important, is that good programmers should be measured by what they can learn, not what they already know. Gabriel Weinberg, DuckDuckGo's creator, has been wo...

   Learning,Knowing,Google,DuckDuckGo     2012-04-18 07:17:53

  Good to Great Python reads

A col­lec­tion of python “must reads”:The Python yield key­word explainedPython’s super() con­sid­ered super!Under­stand­ing Python DecoratorsWhat is a meta­class in Python?Meta­classes DemystifiedTry/Catch for val­i­da­tion or speed?Python (and Python C API): __new__ ver­sus __init__Python “self” keywordPython and the Prin­ci­ple of Least AstonishmentA Curi­ous Course on Corou­tines and Concurr...

   Python,Reference,eBook,Reading Material     2011-11-15 11:46:12

  Read 10 new books from O'Reilly for free

Recently O'Reilly provided free access to some books. Some of them are even in early release status. Here we recommend 10 of them. 1、Mastering Perl 2、Git Pocket Guide 3、Vagrant: Up and Running 4、High Performance Browser Networking 5、802.11ac: A Survival Guide 6、Test-Driven Development with Python 7、Interactive Data Visualization for the Web 8、HTML5 Canvas 9、Programming JavaScript Applications 10、Agile Data Source : http://linu...

   O'Reilly,Free book,Early release     2013-07-03 07:56:20

  Why Dynamic Programming Languages Are Slow

In a statically typed language, the compiler knows the data-type of a variable and how to represent that. In a dynamically-typed language, it has to keep flag describing the actual type of the value of the variable, and the program has to perform a data-dependent branch on that value each time it manipulates a variable.  It also has to look up all methods and operators on it. The knock-on effect of this on branching and data locality is lethal to general purpose runtime performance. T...

   Dynamic language,Slow,Analysis     2012-03-26 15:33:11

  Python Patterns - An Optimization Anecdote

The other day, a friend asked me a seemingly simple question: what's the best way to convert a list of integers into a string, presuming that the integers are ASCII values. For instance, the list [97, 98, 99] should be converted to the string 'abc'. Let's assume we want to write a function to do this. The first version I came up with was totally straightforward: def f1(list): string = "" for item in list: string = string + chr(item) return string ...

   Python,Optimization,Anecdote,Loopup,ASCII     2011-12-18 10:52:49

  Python object creation sequence

[The Python version described in this article is 3.x] This article aims to explore the process of creating new objects in Python. As I explained in a previous article, object creation is just a special case of calling a callable. Consider this Python code: class Joe: pass j = Joe() What happens when j = Joe() is executed? Python sees it as a call to the callable Joe, and routes it to the internal function PyObject_Call, with Joe passed as the first argument. PyObject_Call looks at the ty...

   Python,Object creation     2012-04-16 15:03:55

  I'm not good enough to work on open source software

Actually, that's not true - I've produced plenty of open source software over the years.  However, in a sense, it is true: only the very best actually get paid to work on open source software full time, and I'm not one of them.  People like Linus Torvalds.  People like Guido van Rossum, although even he supposedly divides his time, and does not work on Python full-time. Think about that.  Python is a hugely popular programming language used by many companies and ind...

   Open source,Free,Money,Full-time     2012-04-16 13:27:35

  Learn these technical skills within one day

It takes days and days reading books, practicing and involving in real project if you want to learn a programming language well. It's just like a marathon, you will get more if you can insist longer. During this long and boring period, there are always something you can learn within a short period of time, like within one day. These skills can bring your big satisfaction. Below are a list of technical skills which you can pick up within one single day, they are advocated by Jacob Jensen, a Googl...

   Technical skill     2014-06-12 09:33:15