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

SEARCH KEYWORD -- python



  Python internals: adding a new statement to Python

This article is an attempt to better understand how the front-end of Python works. Just reading documentation and source code may be a bit boring, so I’m taking a hands-on approach here: I’m going to add an until statement to Python. All the coding for this article was done against the cutting-edge Py3k branch in the Python Mercurial repository mirror. The until statement Some languages, like Ruby, have an until statement, which is the complement to while (until num == 0 is equi...

   Python,New statement,Research,Addition     2012-03-12 07:32:24

  Scala, Patterns and The Perl Effect

He tried to understand that one concept for a couple of months before it made sense to him. Admittedly, partial functions are not intuitive for anyone who has been schooled in traditional programming, but still, looking at the problem he was trying to solve it seemed like James was required to expend too much effort relative to the simplicity of the problem (as he pointed out, now that he understands the concept it seems straightforward). He showed me the code, and it was basically a situa...

   Scala,Perl,Pattern,Partial function,Template     2011-12-21 09:25:41

  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...

   Python,Multimethod,Argument list,Version,Overloadding     2011-12-07 08:41:03

  Bing now supports code search

In programmer's daily life, much time is spent on searching Google or StackOverflow for code snippets which can help them understand how the code works. Now there is one more option. Microsoft's Bing now adds a new feature which support code snippet search. With this new feature, you can search code snippet and execute them directly within the search results. For example, if you type "quick sort java", you will see below search result : This feature now supports a few popular programming langua...

   BING,CODE SEARCH,HACKERRANK     2016-04-09 02:49:25

  Why learning Haskell/Python makes you a worse programmer

I've found, contrary to what you sometimes read, that learning Python and Haskell has not improved my programming using other languages. Haskell in particular, being so different from imperative languages, is supposed to give new insights into programming that will help you even when you are not using the language. My current experience doesn't exactly tally with this, and here is why:Demotivation.I find I think in Python, and even in Haskell to some extent, even though I have used Has...

   Python,Programmer,Bad,Bad programmer,Haskell     2011-10-29 07:13:44

  Why so many Python web frameworks?

When asked about the plethora of web frameworks for Python the answer is often that it is way too easy to put together one in Python. That certainly seems plausible since there are so many libraries that implement the components of a web framework and if it's easy to plug those pieces together then maybe that lowers the bar of entry for new frameworks. So let's give it a shot, we'll pick some components and spend a couple hours seeing how far we can get building a web framework, which we...

   Python,Web framework,Dynamic scripting language,Web design     2012-02-13 05:32:48

  Those famous Emacs users

I don't think using Emacs can improve one's programming skills, I don't think some famous people used Emacs before can provide something, either. But these famous people encouraged me to learn Emacs when I wanted to give it up. Here I created a list of famous Emacs users. Most of people in this list are not famous because they developed or used Emacs, but they are famous and also use Emacs. Joe Armstrong -- Erlang's author In The Setup, Joe mentioned that "I write books using XML markup in emacs...

   Emacs,History     2013-07-28 21:36:09

  Python internals: how callables work

[The Python version described in this article is 3.x, more specifically - the 3.3 alpha release of CPython.] The concept of a callable is fundamental in Python. When thinking about what can be "called", the immediately obvious answer is functions. Whether it’s user defined functions (written by you), or builtin functions (most probably implemented in C inside the CPython interpreter), functions were meant to be called, right? Well, there are also methods, but they’re not very ...

   Python,Callable work,Rationale     2012-03-24 05:20:27

  Turn browser into notepad with one line of code

This is the code shared by Jose on codewall. When you type data:text/html,   into the address bar of the browser and press enter, the browser will turn into a notepad which you can edit. Why it works? This uses Data URI’s format and it tells the browser to render HTML. But contenteditable is a property of HTML5, so this can only work in the web browser which supports this property. Here are some interesting contents. Some people make some changes to the code encouraged by the ide...

   HTML5, Browser editor     2013-01-30 04:20:54

  Binary tree iterator algorithm

Binary tree pre-order,in-order and post-order traversal are basics in algorithm and data structure.And the recursive binary tree traversal is a classical application of recursion. We define a binary tree node as : // C++ struct Node { int value; Node *left; Node *right; } In order binary tree traversal can be: // C++ void inorder_traverse(Node *node) { if (NULL != node->left) { inorder_traverse(node->left); } do_something(node); if (NULL != node->righ...

   Binary tree,Iterator,Traversal     2013-07-14 21:51:09