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

 ALL


  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


  Writing API clients in Perl and Python

I recently released a couple of API clients for the Ge.tt file sharing service, one in Perl and one in Python. (I am just a fan of the service, not an employee or contractor.) I would judge myself an "intermediate" pythonista mostly due to inexperience. It's a culture shock coming from a background of CPAN. The old joke is that Perl is just a life support system for CPAN and that is arguably true, but I am here to tell you: you may not appreciate how good Perl hackers have it with respect to CPAN and the culture around documenting, packaging and testing distros once they're on CPAN.It's hard ...

4,991 0       PATTERN PYTHON API PERL API WRITING


  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


  Looking for a Job? Learn Ruby, Python and be a Team Player!

What makes a great software engineer and perhaps more importantly, what skills will most likely land you a sweet job?  Mixtent and KISSMetrics analyzed LinkedIn data and surveyed users on perceptions of candidate skill levels based on their profiles and purported skill sets.The key findings?Python engineers are perceived as better engineersEngineers with teamwork, dedication and a solid work ethic are perceived as better engineers.  Creativity and communication skills are less valued.Ruby engineers are viewed a good front-end, as well as back-end engineersHiring Managers â...

7,487 0       RUBY PYTHON SKILLS TEAMWORK JOB SEEKING


  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