Python: Change class type name
How would you change a class type name to something other than classobj? class bob(): pass foo = bob print "%s" % type(foo).__name__ which gets me 'classobj'. ...
How would you change a class type name to something other than classobj? class bob(): pass foo = bob print "%s" % type(foo).__name__ which gets me 'classobj'. ...
It seems there are at least five Python libraries for the Twitter API. Can those who have used them comment on your experiences? ...
I have this decorator, used to decorate a django view when I do not want the view to be executed if the share argument is True (handled by middleware) class no_share(object): def __init__(self, view): self.view = view def __call__(self, request, *args, **kwargs): """Don't let them in if it's shared""" i...
What is the best way to handle portions of a second in Python? The datetime library is excellent, but as far as I can tell it cannot handle any unit less than a second. ...
I am trying to join 2 strings using this code: def __get_temp(self): return float(self.ask('RS')) def __set_temp(self, temp): set = ('SS' + repr(temp)) stat = self.ask(set) return self.check(stat) temp = property(__get_temp, __set_temp) Once together, I then send a signal over a serial bus using PyVisa. However, when...
So this thread is definitely NOT a thread for why Python is better than Ruby or the inverse. Instead, this thread is for objective criticism on why you would pick one over the other to write a RESTful web API that's going to be used by many different clients, (mobile, web browsers, tablets etc). Again, don't compare Ruby on Rails vs Dja...
Is there a Pylucene eclipse plugin? or am I missing something? I want it for Auto complete. Is the import structure same as java lucene ...
I have a super simple django model here: class Notification(models.Model): message = models.TextField() user = models.ForeignKey(User) timestamp = models.DateTimeField(default=datetime.datetime.now) Using ajax, I check for new messages every minute. I only show the five most recent notifications to the user at any time. Wh...
I wanted to visualize a network with the data I have and would like to graph them with specific edge lengths. I use Python, and I've tried networkx and igraph to plot but all seem to assign fixed edge lengths. a.) I wonder if I did the codes wrong or the packages aren't really capable. How do you properly implement specified edge lengt...
I'm following this guide. Python is at C:\Python31 PyQt4 is at C:\Python31\pyqt sip is at C:\Python31\sip Qt is at C:\Qt\4.6.0 I followed the instructions on that guide, but when I tried to test it (from PyQt4.Qt install *), it said the module didn't exist. I checked all the files that guide said should exist, and none of them existe...
I'm trying to interpolate some data for the purpose of plotting. For instance, given N data points, I'd like to be able to generate a "smooth" plot, made up of 10*N or so interpolated data points. My approach is to generate an N-by-10*N matrix and compute the inner product the original vector and the matrix I generated, yielding a 1-by-...
Is there a blog/forum/listserv that is equivalent to RubyQuiz.com for the Python language? ...
I am getting user input into a python application of a local landmark. With this data I am trying to get the longitude and latitude of their object using Google maps. I am trying to work with the Google gdata api for the maps but I did not find a way to get long and lat data from a search query when working in python. I am ok using any...
I have a GTK layout with a widget on the left of an HBox deciding the maximum height I want, and a VBox on the right containing three buttons, each containing only an image and no text. The images are a GTK stock icon, and so have the stock storage type. Using expand=True, fill=True packing the buttons without images are exactly the hei...
Why does the following print a blank line instead of 'Hello QProcess'? import sys from PyQt4 import QtGui, QtCore proc = QtCore.QProcess() proc.start("echo 'Hello QProcess'") proc.waitForFinished() result = proc.readAll() print result proc.close() I'm on Windows XP, btw. ...
Is there a Lua equivalent for python's shlex library? ...
I'm working with my Django app. For some reason an element of a list is being assigned incorrectly. I'm trying to set a break where I think the error is occurring. ( line 20 ) I'm invoking pdb with this line of code: import pdb; pdb.set_trace() However, inside the code, I can't seem to set a Break. (Pdb) b 20 *** Blank or comment ...
I'm using Capistrano to deploy a Django application (it uses Nginx as the web server), using instructions I found at http://akashxav.com/2009/07/11/getting-django-running-on-nginx-and-fastcgi-on-prgmr/ (I had to look at a cached version earlier today) and was wondering about the last command in there, which is python manage.py runfcgi ...
I need to keep track of units on float and int values in Python, but I don't want to use an external package like magnitude or others, because I don't need to perform operations on the values. Instead, all I want is to be able to define floats and ints that have a unit attribute (and I don't want to add a new dependency for something thi...
Hi, I am incredibly new to Python and I really need to be able to work this out. I want to be asking the user via raw_input what the module and grade is and then putting this into the dictionary already defined in the Student class as grades. I've got no idea what to do! Thanks in advance! students = [] # List containing all student obj...