Daily Python-URL! (from the Secret Labs) :
Fredrik Johansson:Making division in Python faster["Python is clever enough to use the Karatsuba algorithm for multiplication of large integers, which gives an O(n1.6) asymptotic time complexity for n-digit multiplication. This is a huge improvement over the O(n2) schoolbook algorithm when multiplying anything larger than a (Read More)
Daily Python-URL! (from the Secret Labs) :
Fredrik Lundh:Simple Top-Down Parsing in Python["In the early seventies, Vaughan Pratt published an elegant improvement to recursive-descent in his paper Top-down Operator Precedence. Pratt's algorithm associates semantics with tokens instead of grammar rules, and uses a simple 'binding power' mechanism to handle precedence (Read More)
The Django weblog :
A short while ago, weannounced the creation of the Django Software Foundation, a non-profitorganization that exists (among other reasons)to sponsor Django codingsprints and other events for our community. Now, we're kick-starting the foundation by holding a fundraising drive.With Django1.0 around the corner, our immediate g (Read More)
Daily Python-URL! (from the Secret Labs) :
Daniel Ostermeier/Jason Sankey:
Using Python Via The New Java 6 Scripting Engine
["Do you ever find yourself writing Java code that interacts with external processes and systems, but wish you could use a scripting language more suited to the task? If you have Java 6 available to you, then you are in luck."]. (Read More)
Only Python :
The Python doctest module rocks. Lately, I have been using it to write unit tests for Crunchy: for each module, I write a reStructuredText file which contains sample tests written as simulated interpreter sessions, using doctest.testfile(). This has worked really well in general ... however, I have encountered one small a (Read More)
life is short - you need Python! :
I have to use MySQL database frequently. Interacting with MySQL is easy and simple. There is a nice module named MySQLdb is available for this purpose.I am not writing details about using it as there is a good tutorial "Writing MySQL Scripts with Python DB-API" available online. I myself read this when I used MySQL with Pyt (Read More)
life is short - you need Python! :
This is a very common problem for the beginners who try to write web crawler / spider / scraper. The content is fetched but regex is not working right. :(But the problem is not with the regular expression. You just need to add the following two lines after you fetch content of a web page:content = content.replace("\n", "")c (Read More)
life is short - you need Python! :
To run Python program in windows, I have downloaded and installed python windows installer from http://www.python.org/download/. IDLE is installed by default when I install the python windows installer. So python programs can be written and/or executed using IDLE. Or you can just double click a program to run it. Another wa (Read More)
life is short - you need Python! :
Check the following code:def fibonacci(x): if x < 2: return 1 return (fibonacci(x-2) + fibonacci(x-1)) def factorial(x): if x < 2: return 1 return (x * factorial(x-1)) def main(): funcs = [fibonacci, factorial] n = 10 for i in range(len(funcs)): print funcs[i](n) (Read More)
life is short - you need Python! :
Here I present a short python program that prints the list of all files inside the current directory and subdirectories. It prints filename with relative path to the current directory.import osfor root, dirs, files in os.walk('./'): for name in files: filename = os.path.join(root, name) print filenameYo (Read More)
PIBlog :
Edit:I’ve cleaned up the longer example, using Python’s string.Template module for the templates.I’ve also set up a git repo for the source that will go along with posts to this series:Python Webapp GitwebRecently, I’ve been interested in writing web applications in Python, and one of the fun things (Read More)
The Voidspace Techie Blog :
A while ago I experimented with an interactive Python interpreter that ran in the browser using Silverlight. Unfortunately a couple of bugs with the version of IronPython for Silverlight prevented it from working properly. ... [361 words]
. (Read More)
The Voidspace Techie Blog :
The May edition of the Python Magazine is out; and technically it's still May so that counts I guess. The major articles are: Handling Configuration Files with ConfigObj LDAP backed initScripts in Python Learning Python with PyGame: The Simplest Thing that Can Possibly Work Writing a Simple Interpreter/Compiler with Pyparsi (Read More)
Python | Dev :
Does anyone have a clue about why this test fails only on this platform? The test is question is verifying that URLError gets raised. From the trace. (Read More)
Python :
Hi guys,My group and I will be working on our final year project, the scope todo a program/web-based application similar areas of functionalitieslike the PyLint and PyChecker; a Python syntax checker. We have noPython background, equipped only with some knowledge of Java and Dotnet.We did some research on PyLint and found o (Read More)