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

 PYTHON


  Standardizing Python WSGI deployment

Over the past year I have been testing all of the new python platform as a service companies that have popped up, and I have posted my notes on my blog so that everyone can learn from my experiences. ep.io, apphosted.com, gondor.io, dotcloud.com, DjangoZoom.com, Heroku, Django hosting roundup,All and all, the platforms were very similar, they allowed you to easily host your python/django project without having to worry about managing a server or other typical system administration duties. Some of the services were more advanced and had more features then others, but since it was s...

2,813 0       JAVA PYTHON STANDARD WAR


  Python threads: communication and stopping

A very common doubt developers new to Python have is how to use its threads correctly. Specifically, a large amount of questions on StackOverflow show that people struggle most with two aspects:How to stop / kill a threadHow to safely pass data to a thread and backI already have a blog post touching on these issues right here, but I feel it’s too task-specific for sockets, and a more basic and general post would be appropriate. I assume the reader has a basic familiarity with Python threads, i.e. has at least went over the documentation.So, without further ado, here’s a sample "w...

2,981 0       PYTHON MULTITHREADING COMMUNICATION SYNCHRONIZE


  Unfortunate Python

Python is a wonderful language, but some parts should really have bright WARNING signs all over them. There are features that just can't be used safely and others are that are useful but people tend to use in the wrong ways.This is a rough transcript of the talk I gave at my local Python group on November 15, with some of the audience feed back mixed in. Most of this came from hanging around the Python IRC channel, something I highly recommend.[update 2011-12-19: improved "array" critique, add "python -i" suggestion to "reload" critique, add html targets to sections]Easy Stuff FirstStarting...

3,081 0       PYTHON WARNING DEFECTS DEPRECATED METHODS


  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 stringThat can't be the fastest way to do it, said my friend. How about this one: def f2(list): return reduce...

10,633 0       OPTIMIZATION PYTHON ANECDOTE LOOPUP ASCII


  Thoughts on Python 3

I spent the last couple of days thinking about Python 3's current state alot. While it might not appear to be the case, I do love Python as alanguage and especially the direction it's heading in. Python has been notonly part of my life for the last couple of five years, it has been thelargest part by far.Let there be a warning upfront: this is a very personal post. I counted ahundred instances of a certain capital letter in this text.That's because I am very grateful for all the opportunities I got over thelast few years to travel the world, to talk to people and to share thespirit that an ...

1,917 0       PYTHON FEATURE DRAWBACK PYTHON 3 EMBRACE


  Five-minute Multimethods in Python

So what are multimethods? I'll give you my own definition, as I've come to understand them: a function that has multiple versions, distinguished by the type of the arguments. (Some people go beyond this and also allow versions distinguished by the value of the arguments; I'm not addressing this here.)As a very simple example, let's suppose we have a function that we want to define for two ints, two floats, or two strings. Of course, we could define it as follows:def foo(a, b): if isinstance(a, int) and isinstance(b, int): ...code for two ints... elif isinstance(a, float) and is...

2,374 0       PYTHON MULTIMETHOD ARGUMENT LIST VERSION OVERLOADDING


  Strangest line of python you have ever seen

The other day @HairyFotr and @zidarsk8 were doing some codegolfing with implementations of nondeterministic finite state machineand asked me to blog their results.For those of us who often forget what all of this computer science mumbo jumbo means, here’s a quick explanation from wikipedia:In the theory of computation, a nondeterministic finite state machine or nondeterministic finite automaton (NFA) is a finite state machine where for each pair of state and input symbol there may be several possible next states.Essen...

2,057 0       PYTHON STRANGE RESEARCH WORK RATIONALE


  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 ConcurrencyGen­er­a­tor Tricks for Sys­tems ProgrammersCode like a Python­ista: Idiomatic Py...

2,967 0       PYTHON REFERENCE EBOOK READING MATERIAL