Where can i get the technical manuals/details of how django internals work, i.e. i would like to know when a request comes in from a client;
which django function receives it?
what middleware get called?
how is the request object created? and what class/function creates it?
What function maps the request to the necessary view?
How d...
I have a single code file for my Google App Engine project. This simple file has one class, and inside it a few methods.
Why does this python method gives an error saying global name not defined?
Erro NameError: global name 'gen_groups' is not defined
import wsgiref.handlers
from google.appengine.ext import webapp
from django.utils im...
I have been trying to make the NLTK (Natural Language Toolkit) work on the Google App Engine. The steps I followed are:
Download the installer and run it (a .dmg file, as I am using a Mac).
copy the nltk folder out of the python site-packages directory and place it as a sub-folder in my project folder.
Create a python module in the fo...
Is it possible to make a decorator that makes attributes lazy that do not eval when you try to access it with hasattr()? I worked out how to make it lazy, but hasattr() makes it evaluate prematurely. E.g.,
class lazyattribute:
# Magic.
class A:
@lazyattribute
def bar(self):
print("Computing")
return 5
>>> a = A...
I need to convert a date from a string (entered into a url) in the form of 12/09/2008-12:40:49. Obviously, I'll need a UNIX Timestamp at the end of it, but before I get that I need the Date object first.
How do I do this? I can't find any resources that show the date in that format? Thank you.
...
I am struck in a small recursive code. I have printed output and it prints fine but when I try to put a counter to actually count my answers, it gives me scooping errors.
total = 0
def foo(me, t):
if t<0:
return
if t==0:
total = total+1
return
for i in range(1, me+1):
total = total+1
return foo(i, t-...
In order to save space and the complexity of having to maintain the consistency of data between different sources, I'm considering storing start/end indices for some substrings instead of storing the substrings themselves. The trick is that if I do so, it's possible I'll be creating slices ALL the time. Is this something to be avoided?...
I need to write python application connect to trixbox that run as SIP server. But I not found any library that implement in python. I found SIP SKD at http://www.vaxvoip.com/ but it not support python. Can anyone suggest me an alternative to VaxVoip?
Thank you.
...
I'm trying to convert a datetime object to a UNIX timestamp (preferably in milliseconds, though I wouldn't mind with and without).
Mktime seems to be the method that usually gets it, however I keep getting the error:
AttributeError: type object 'datetime.time' has no attribute 'mktime'.
Can anyone tell me what I'm doing wrong? I keep...
Hello,
I would like to ask which IDE should I use for developing applications for Google App Engine with Python language?
Is Eclipse suitable or is there any other development environment better?
Please give me some advices!
Thank you!
...
Hi,
I need to handle tens of Gigabytes data in one binary file. Each record in the data file is variable length.
So the file is like:
<len1><data1><len2><data2>..........<lenN><dataN>
The data contains integer, pointer, double value and so on.
I found python can not even handle this situation. There is no problem if I read the wh...
I'm writing a new one (for Netflix), and am simply wondering if there are any great reference libraries for me to study.
In particular I'm looking for clever ways to express a single REST endpoint in code, which needs a least a URL, method, and params, and in the case of Netflix, information about the authentication level required.
...
Hello, I am using eclips for python and i am facing a problem. I have many classes with many properties and want a list of objects from one of my declared classes. The problem is:When i am accessing any item from the list, the IDE does not know it's type because in python we do not declare the variable with it's type, so there is no auto...
I am looking for any way to have Emacs format a Python buffer by hitting a few keys. By format, I mean:
Replace tabs with 4 spaces
Wrap all long lines correctly at 79 chars. This includes wrapping & concatenating long strings, wrapping long comments, wrapping lists, function headers, etc.
Unrelated, but when I hit enter, it'd be nice...
I have been trying to create a decorator that can be used with both functions and methods in python. This on it's own is not that hard, but when creating a decorator that takes arguments, it seems to be.
class methods(object):
def __init__(self, *_methods):
self.methods = _methods
def __call__(self, func):
def...
I am using Pyme to interface with GPGME and have had no problems signing / encrypting. When I try to decrypt, however, it always brings up the prompt for the passphrase despite having set it via a c.set_passphrase_cb callback. Am I doing something wrong?
...
Is there a python equivalent of jstack? I've got a hung process and I really want to see what it's up to because I have yet to reproduce the defect in development.
...
How can I draw a “braced” line between two arbitrary points with Pyx?
It would look something like this:
...
So I knocked up some test code to see how the multiprocessing module would scale on cpu bound work compared to threading. On linux I get the performance increase that I'd expect:
linux (dual quad core xeon):
serialrun took 1192.319 ms
parallelrun took 346.727 ms
threadedrun took 2108.172 ms
My dual core macbook pro shows the same beha...
How do I test the following code with mocks (using mocks, the patch decorator and sentinels provided by Michael Foord's Mock framework):
def testme(filepath):
with open(filepath, 'r') as f:
return f.read()
...