I'm trying to install matplotlib for Python on MacOS X. If I use the system Python 2.6.1, the default compiler commands that matplotlib uses (presumably via distutils) are::
gcc-4.2 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes
g++-4.2 -Wl,-F. -bundle -undefined dynamic_lookup
However, if I simply add the python.org 2.6.6 Python t...
What I'm trying to do is get 3 values from a key into separate variables. Currently I'm doing it like this:
for key in names:
posX = names[key][0]
posY = names[key][1]
posZ = names[key][2]
This doesn't seem very intuitive to me even though it works. I've also tried doing this:
for key, value in names:
location = value
U...
I would like a datetime in python to output like this:
Thu the 2nd at 4:30
But I find no way in python to output st, nd, rd, or th like I can with PHP datetime format with the S string (What they call "English Ordinal Suffix") (http://uk.php.net/manual/en/function.date.php).
Is there a built-in way to do this in python? strftime isn'...
I'm designing a cross-platform map editor for an application I've developed, and I'm unsure what approach to take regarding language/gui library choice. Just for some basic info, the editor needs to parse and output xml files.
I'm most comfortable with C++, Lua, and Perl, but I'd also be willing to use Python (could use the practice). I...
I'm using django-profiles in my app, as it gives me a few simple views that helps me get where I want to go, faster.
However, I have one problem. Given the models below, how can I create a form for editing a profile that includes all the fields on UserProfile, the first_name, last_name and email fields from User, and one or more PhoneNu...
self.attributes("-alpha", Alpha)
How do I get window attributes in Tkinter? Currently I wan't my program to get the value of Alpha.
...
I am using this simple example to understand Python's getattr function:
In [25]: class Foo:
....: def __getattr__(self, name):
....: print name
....:
....:
In [26]: f = Foo()
In [27]: f.bar
bar
bar
Why is bar printed twice? Using Python 2.6.5.
...
Why are mutable strings slower than immutable strings?
EDIT:
>>> import UserString
... def test():
... s = UserString.MutableString('Python')
... for i in range(3):
... s[0] = 'a'
...
... if __name__=='__main__':
... from timeit import Timer
... t = Timer("test()", "from __main__ import test")
... print t.t...
I am new to programming.. I was thinking to start learning with Ruby or Python. y main task would be web development. But I cannot choose between them. Which language do you think I should learn?
...
Hello, I'm trying to retrieve the row data from a treemodel when the row_activated callback is fired.
When row_activated is called, the 'path' variable it passes is a tuple. How do I easily use this tuple to retrieve an iter and ultimately the data itself? The treemodel class has a function to convert a string into an iter, but it seems...
Hello everyone. I am trying to write a simple neural network that can come up with weights to for, say, the y=x function. Here's my code:
http://codepad.org/rPdZ7fOz
As you can see, the error level never really goes down much. I tried changing the momentum and learning rate but it did not help much. Is my number of input, hidden and ou...
I'm developing a web application that needs to interface with a MySQL database, and I can't seem to find any really good modules out there for Python.
I'm specifically looking for fast module, capable of handling hundreds of thousands of connections (and queries, all within a short period of time of each other), without an significant i...
I am looking over: http://docs.djangoproject.com/en/1.2/topics/auth/#django.contrib.auth.models.User but just can't seem to figure out how to do this as its not working. I need to check if the current site user is logged in (authenticated), and am trying:
request.user.is_authenticated
despite being sure that the user is logged in, it ...
I am switching from Linux to OSX and when I run our build's setup.py script, I get an error message that contains the text
This script requires setuptools version 0.6c7.
I have tried several times to install setuptools, and have verified that the setuptools egg exists in /Library/Python/2.6/site-packages. I have no idea why it is n...
Im trying to use port 80.
So when i use the command "sudo paster serve development.ini --reload"
I get this error
pkg_resources.VersionConflict: (Pylons 0.9.7 (/usr/lib/pymodules/python2.6), Requirement.parse('Pylons>=1.0'))
I tried to do "easy_install pylons"
but I get
"Pylons 1.0 is already the active version in easy-install.pth...
I am writing a program which reads input from a file called 'votes.txt'.
It reads in some line of information, each of which is a 'vote' with parties ordered by preference.
The program needs to take this data, and output the winner of the election.
My Code is as follows:
# Define the count_votes() function
def count_votes(to_count):
...
Hi,
I have a programming question, as follows, for which my solution does not produce the desired output
This particle simulator operates in a universe with different laws of physics to ours. Each particle has a position (x, y), velocity (vx, vy) and an acceleration (ax, ay). Every particle exerts an attractive force on every other ...
Is there an online resource that shows how to write a simple (but robust) RESTFUL server/client (preferably with authentication), written in Python?
The objective is to be able to write my own lightweight RESTFUL services without being encumbered by an entire web framework. Having said that, if there is a way to do this (i.e. write RESF...
I am trying to add a transaction to keep from creating two entities with the same attribute. In my application, I am creating a new Player each time I see a new Google user logged in. My current implementation occasionally creates duplicate players when multiple json calls are made by a new Google user within a few milliseconds. When I a...
As you may know, ActionScript allows you to mark a variable as [Bindable], causing any changes to that variable to have immediate effect all over your application. Pretty neat.
How would you implement this feature in your favourite programming language? My first guess was to use events or wrapper classes, but I couldn't come up with a c...