I've used Matlab on and off before, but I need to develop a good understanding of it now, and the language I'm most familiar with is Python. Care to describe a Matlab language feature, idiom, best practice or philosophy as compared to Python?
There's a terrific amount of buzz for and resources pertaining to going the opposite direction...
Ruby has this really handy module called Pathname.
Is there a python equivalent to it?
...
q = WorldObject.all()
# define boundaries
# left
q.filter('x >=', x)
# right
q.filter('x <', x + width)
# top
q.filter('y >=', y)
# bottom
q.filter('y <', y + height)
#q.filter('world', world_key)
wobjects = q.fetch(1000)
I got an error saying I can't use multiple sorts
q = WorldObject.all()
q.filter('xy >=', db.GeoPt(1, 1))
q.filt...
I am teaching myself some Python and I have come across a problem which is probably plainly obvious, except that I can't see it and I need another pair of eyes.
I am making a small game I made into a gui program.
I have this section of code, which when run gives me
"Traceback (most recent call last):
File "", line 21, in
Syntax Er...
Following the example here, "Augementing .pxd", I'm trying to use ".pxd" files to augment a pure python file. (Add type definitions external to the pure python file).
python file:
class A(object):
def foo(self, i=3, x=None):
print "Big" if i > 1000 else "Small"
pxd file:
cdef class A:
cpdef foo(self, int i, x)
I've...
So I've created a form that includes the following item
<input type="file" name="form_file" multiple/>
This tells the browser to allow the user to select multiple files while browsing. The problem I am having is is that when reading / writing the files that are being uploaded, I can only see the last of the files, not all of them. I w...
I am playing with python and am able to get the intersection of two lists:
result = set(a).intersection(b)
Now if d is a list containing a and b and a third element c, is there an built-in function for finding the intersection of all the three lists inside d? So for instance,
d = [[1,2,3,4], [2,3,4], [3,4,5,6,7]]
then the result sh...
hi guys, I encountered an error when doing the following retrieval:
class status(models.Model):
pid = models.IntegerField()
phase = models.TextField()
rejected = models.IntegerField()
accepted = models.IntegerField()
type = models.IntegerField(default=1)
date = models.DateTimeField(primary_key = True)
time_t...
Hi,
I have a long-running Python process that is generating more data than I planned for. My results are stored in a list that will be serialized (pickled) and written to disk when the program completes -- if it gets that far. But at this rate, it's more likely that the list will exhaust all 1+ GB free RAM and the process will crash, lo...
I have a set of URL's in my django application that trigger certain actions or processes. This would be similar to cron jobs. I have a script that polls one or more of these URLS at some regular inverval and I'm interested in adding a layer of security.
I'd like to set up an account for the script and require authentication before the...
I'm using pyinotify to mirror files from a source directory to a destination directory. My code seems to be working when I execute it manually, but I'm having trouble getting accurate unit test results. I think the problem boils down to this:
I have to use ThreadedNotifier
in my tests, otherwise they will
just hang, waiting for manual...
I finding some great solution to convert XML to dict in python
...
Hi,
For great help from stackoverflow, the development for the Mac version of my program is done.
Now I need to deploy my program, and I was wondering if there is any way to "hide" my running Python code (it also runs .so library and it seems it makes a dock item to appear).
The program is supposed to be running in the background and ...
The following code runs fine in my IDE (PyScripter), however it won't run outside of it. When I go into computer then python26 and double click the file (a .pyw in this case) it fails to run. I have no idea why it's doing this, can anyone please shed some light?
This is in windows 7 BTW.
My code:
#!/usr/bin/env python
import ma...
I have written some code that queries adns. Problem with this code is that it gets stuck, how? Let me explain it:
Say my dnslist is ["8.8.4.4", "8.8.8.8", "208.67.220.220", "208.67.222.222", "192.168.50.1"]
It would pop a dns from the list and query againt it, now that means that DNS will be queried in reverse order
No matter what i d...
Hello ! I have a really strange problem with the standard logging module used in django views. Sometimes it works perfectly and sometimes it does not log messages.
Here is the structure of my code :
/mysite/ (Django root)
my_logging.py (logging configuration)
settings.py
views.py (global views)
data_objects.py (objects ...
Hi all,
Is that possible to return a db result which sort by density matching in ListProperty
For example, I have a db.ListProperty(basestring) with below value:
list_A = ['a1','a2','a3','a4','a5']
list_B = ['b1','b2','b3','b4','b5']
list_C = ['a1','a2','b1','b2','b3']
giving to_be_match_list = ['a1','b1','b2'] and return result in ...
Im using python markdown for my django project, when i have the value
#/usr/bin/env python
print "this is converted to html code block"
the output is
<pre><code>
#/usr/bin/env python
print "this is converted to html code block"
</code><pre>
Now my question is that how can i pass class attribute and value to code elem.
Sample:
...
Could someone tell/show how to get the current proccess id with python on windows
there are this function os.geteuid() but its only works with linux/unix could someone tell
what it the pythonic way to get the current proccess id on windows.
...
I'm using argparse in Python 2.7 for parsing input options. One of my options is a multiple choice. I want to make a list in its help text, e.g.
from argparse import ArgumentParser
parser = ArgumentParser(description='test')
parser.add_argument('-g', choices=['a', 'b', 'g', 'd', 'e'], default='a',
help="Some option, where\n"
...