I have a the following class:
class Vector(object):
def __init__(self, x=0, y=0, z=0):
self.x = x
self.y = y
self.z = z
def _getx(self):
return self._x
def _setx(self, value):
self._x = float(value)
x = property(_getx, _setx)
def _gety(self):
return self._y
def _...
Many languages of REPL consoles with additional features like autocomplete and intellisense. For instance, iPython, Mathematica, and PyCrust all make some effort to go beyond a basic read eval loop. REPLs are particularly useful in languages where interactive exploration is very important, such as Matlab or R.
I'm looking for inspirat...
What happens when you package a script as an executable? Is this a good way to distribute commercial applications? I remember I read something a long time ago that when you package scripts as executables, at runtime the exe decompresses the scripts to a temporary directory where they get ran.
If it's like that, than I don't think this c...
i am learning python and creating a database connection.
while trying to add to the db, i am thinking of creating tuples out of information and then add them to the db.
WHAT I AM DOING:
i am taking info from the user and store them in variables.
can i add these variables into a tuple? can you please help me with the syntax?
also if t...
I am writing a program in python to experiment an academic idea. Look at a resultant image the program generates:
The thick skeleton lines in the middle of the leaf is what need to be visualized. Every segment of the skeleton lines has a value associated with it, in the above image (drawn by pycairo), different shades of gray are us...
I have a large list with 15k entries in a MySQL table from which I need to select a few items, many times. For example, I might want all entries with a number field between 1 and 10.
In SQL this would be easy:
SELECT text FROM table WHERE number>=1 AND number<10;
If I extract the entire table to a Python list:
PyList = [[text1, numb...
I was thinking of using the logging module to log all events to one file. The number of threads should be constant from start to finish, but if one thread fails, I'd like to just log that and continue on. What's a simple way of accomplishing this? Thanks!
...
Hi everyone!
I have the function prototype here:
extern "C" void __stdcall__declspec(dllexport) ReturnPulse(double*,double*,double*,double*,double*);
I need to write some python to access this function that is in a DLL.
I have loaded the DLL, but
each of the double* is actually pointing to a variable number of doubles (an array), and
...
I've compiled a Python module using my own Qt4 library located in ~/opt/qt-4.6.0/,
but when I try to import that module, the dynamic libraries that get loaded are from my MacPorts Qt4 installation.
$ /opt/local/bin/python2.6
>>> import vtk
objc[58041]: Class QMacSoundDelegate is implemented in both /Users/luis/opt/qt-4.6.0/lib/QtGui.fr...
I thought I'd start learning a real programming language from scratch. I can manage to code in C++, but I haven't been brushing up on my C++ skills at all.
This time I'm teaching myself. And I've decided on python. Is it the right language for me? I'm just being an enthusiastic kid, and I'm not learning for any strict purpose (rather th...
In the code shown below, I need to manipulate the time var in python to display a date/time stamp in python to represent that delay.
for example, when the user enters the delay time in hours, i need to set the jcarddeliver var to update itself with the value of the current date/time + delay
also it should update the date var as well. for...
There is a hierchy of classes. Each class may define a class variable (to be specific, it's a dictionary), all of which have the same variable name. I'd like the very root class to be able to somehow access all of these variables (i.e. all the dictionaries joined together), given an instance of a child class. I can't seem to find the way...
Hi
I have a website which fetches information from RSS feeds periodically (well, currently manually, and this is my problem). This is currently implemented as a normal Django view, which isn't very nice in my opinion. I'd like to have a Python program which is run using a cronjob instead of manually visiting the correct URL to update ...
Hi,
Is there a good way in C# to mimic the following python syntax:
mydict = {}
mydict["bc"] = {}
mydict["bc"]["de"] = "123"; # <-- This line
mydict["te"] = "5"; # <-- While also allowing this line
In other words, I'd like something with [] style access that can return either another dictionary or a string type, depending o...
Hello,
I want to store events in a web application I am fooling around with and I feel quite unsure about the pros and cons of each respective approach - using inheritance extensively or in a more modest manner.
Example:
class Event(models.Model):
moment = models.DateTimeField()
class UserEvent(Event):
user = models.ForeignKe...
Hello,
First of all, thank you for taking the time to read this. I am new to developing applications for the Mac and I am having some problems. My application works fine, and that is not the focus of my question. Rather, I have a python program which essentially does this:
for i in values:
os.system(java program_and_options[i])
...
I have a function I am consuming that returns a string of latex code. I need to generate an image from this. Most of the methods I have seen for doing so suggest calling an external application via say the subprocess module which will generate the image for me.
However, management is not keen on this as it will require external user...
can anyone show me the syntax for inserting a python tuple/list into a mysql database?
i also need to know if it is possible for user to pass certain rows without inserting anything...
for example: a function is returning this tuple:
return job(jcardnum, jreg, jcarddate, jcardtime, jcardserve, jdeliver)
suppose the user didnt enter an...
I'm porting over the interpreter for a domain specific language I created from Scala to Python. In the process I tried to find a way that way pythonic to emulate the case class feature of Scala that I used extensively. In the end I resorted to using isinstance, but was left feeling that I was perhaps missing something.
Articles such as ...
Howdy all -
Here is the prototype for a C function that resides in a DLL:
extern "C" void__stdcall__declspec(dllexport) ReturnPulse(double*,double*,double*,double*,double*);
In another thread, I asked about how to properly create and send the necessary arguments to this function.
Here is the thread:
http://stackoverflow.com/question...