I can't seem to find a quick answer on how to get Datastore descendants given a reference to the parent entity. Here's a quick example:
# a person who has pets
john=Person(**kwargs)
# pets
fluffy=Pet(parent=john, ...)
rover=Pet(parent=john, ...)
# lengthy details about john that are accessed infrequently
facts=Details(parent=john, .....
Is there a way to use python to encrypt/decrypt a file? Something like Axcrypt
Thanks in advance
...
Here is what I have so far. Is there anyway, I can auto increment the list while it is being built? So instead of having all ones, I'd have 1,2,3,4....
possible = []
possible = [1] * 100
print possible
Thanks,
Noah
...
from TurtleWorld import *
import math
bob = Turtle()
print(bob)
draw_circle(turtle, r):
d = r*2
c = d*math.pi
degrees = 360/25
length = c // 25
for i in range(25):
fd(turtle, length)
rt(turtle, degrees)
draw_circle(bob, 25)
wait_for_user()
The problem in on line 7:
draw_circle(turtle, r):
...
My framework is raising a syntax error when I try to execute this code:
from django.template import Template, TemplateSyntaxError
try:
Template(value)
except TemplateSyntaxError as error:
raise forms.ValidationError(error)
return value
And here's the error:
from template_field import TemplateTextFi...
Here is the situation: the company that I'm working in right now gave me the freedom to work with either java or python to develop my applications. The company has mainly experience in java.
I have decided to go with python, so they where very happy to ask me to give maintenance to all the python projects/scripts related to the database...
So I have two files:
File 1 has this method in it:
import MyGlobals
global old_function
def init():
import ModuleB
global old_function
MyGlobals.SomeNumber = 0
old_function = ModuleB.someClass.function
ModuleB.someClass.function = someNewFunction
File 2 has a class "someClass" and a class "someOtherClass". That be...
How can I update all python modules I have installed on ubuntu?
...
I have thise huge code that I'm going to implement . Before I start that, I want to do a raw_input('Enter something: .'). I want it to sleep for 3 secs and if there's no input, then cancel the raw-input prompt and run the rest of the code. Then the code loops and implements the raw_input again.
I want it so that if somedoes put a raw_i...
How do I find out the memory size of a Python data structure? I'm looking for something like:
sizeof({1:'hello', 2:'world'})
It is great if it counts every thing recursively. But even a basic non-recursive result helps. Basically I want to get a sense of various implementation options like tuple v.s. list v.s. class in terms of memory...
Today I was refactoring some code and revisited an old friend, an Address class (see below). It occurred to me that, in our application, we don't do anything special with addresses-- no queries, only lightweight validation and frequent serialization to JSON. The only "useful" properties from the developer point-of-view are the label an...
So I have list of events that are sort of like alarms. They're defined by their start and end time (in hours and minutes), a range of days (ie 1-3 which is sunday through wed.), and a range of months (ie 1-3, january through march). The format of that data is largely unchangeable. I need to, not necessarily sort the list, but I need to f...
I have
a = [1, 2]
b = ['a', 'b']
I want
c = [1, 'a', 2, 'b']
...
(First, I chose to do this in Python because I never programmed in it and it would be good practice.)
Someone asked me to implement a little "combination" program that basically outputs all possible combinations of a set of group of numbers. Example, if you have:
(1,2,3) as the first set,
(4,5,6) as the second, and
(7,8,9) as the th...
Hi there,
I'd like to combine interactive plotting in Matplotlib and the Command line interface Cmd in python. How can I do this?
Can I use threading? I tried the following:
from cmd import Cmd
import matplotlib.pylab as plt
from threading import Thread
class MyCmd(Cmd):
def __init__(self):
Cmd.__init__(self)
self...
I'm working on learning python, here is a simple program, I wrote:
def guesser(var, num1,possible):
if var == 'n':
cutoff = len(possible)/2
possible = possible[0:cutoff]
cutoff = possible[len(possible)/2]
#print possible
if (len(possible) == 1):
print "Your Number is:", possible
...
Python 2.7 has two different disk image installers for Mac OS X. My questions are:
What are the differences between the two Python 2.7 disk image installers?
Python 2.7 32-bit Mac OS X Installer Disk Image for Mac OS X 10.3 through 10.6
Python 2.7 PPC/i386/x86-64 Mac OS X Installer Disk Image for Mac OS X 10.5 or later
If running Mac...
Django-admin is pluralizing a model that I have running as a proxy class.
The normal case here works fine:
class Triviatheme(models.Model):
[ ... elided ... ]
class Meta:
db_table = u'TriviaTheme'
verbose_name_plural='trivia themes'
But for a main content table, I have a parent model called 'Content', and a p...
I've just started working with setuptools and virtualenv. My package requires the latest python-gearman that is only available from GitHub. The python-gearman version that's on PyPI is an old one. The Github source is setuptools-compatible, i.e. has setup.py, etc. Is there a way to make setuptools download and install the new version ins...
I love both, python and Java and I have this first 'serious' web application project that I would like to carry out.
I find it hard to choose between pyjamas + django and GWT + Hibernate.
In fact, from my beginner point of view, it seems like the python world is more suitable for a quickly-developed and fun web application.
And, on t...