(git version 1.6.5.7)
When I run git diff the output has a nice scope hint after the line numbers for my Python scripts, e.g.:
diff --git a/file.py b/file.py
index 024f5bb..c3b5c56 100644
--- a/file.py
+++ b/file.py
@@ -14,6 +14,8 @@ TITF: Test Infrastructure Tags Format
...
@@ -1507,13 +1533,16 @@ class Tags( object ):
...
Note that...
Is it possible to use P4Python (the perforce python api) with IronPython? I'd like to use the python api because it seems much faster than using p4.net implementionat of a Perforce API but when I try to import p4 into IronPython I receive the following error.
IronPython 2.6.1 (2.6.10920.0) on .NET
4.0.30128.1 Type "help", "copyrigh...
I have two wxListCtrl and want to process the Ctrl+Enter keyboard event without letting wx change the focus to the other ListCtrl.
I have event handlers for wx.EVT_KEY_DOWN, wx.EVT_KEY_UP, wx.EVT_CHAR and KillFocus, but KillFocus is always called first, then the focus changes and the the keyboard handlers are called for the wrong ListC...
Is there any possibility to copy variable by reference no matter if its int or class instance?
My goal is to have two lists of the same objects and when one changes, change is visible in second.
In other words i need pointers:/
I simply want int, float and other standard types which are normally copied by value, force to copy by ref...
I am trying to fumble through python, and learn the best way to do things. I have a string where I am doing a compare with another string to see if there is a match:
if paid[j].find(d)>=0:
#BLAH BLAH
If 'd' were an array, what is the most efficient way to see if the string contained in paid[j] has a match to any value in 'd'?
...
Can I make a class inherit a class "in-program" in Python?
heres what i have so far:
base = list(cls.__bases__)
base.insert(0, ClassToAdd )
base = tuple( base )
cls = type( cls.__name__, base, dict(cls.__dict__) )
...
Hey,
In order to avoid spamming, I would like to add a waiting time to re-submit a form (i.e. the user should wait a few seconds to submit the form, except the first time that this form is submitted).
To do that, I added a timestamp to my form (and a security_hash field containing the timestamp plus the settings.SECRET_KEY which ensure...
I'm setting up a virtualenv, but it seems to be using python2.5 by default.
I'm using this command
virtualenv newenv --no-site-packages -p python
because the python found on my path is python2.6. I believe this to be true because when I type python and go into the shell, it tells me it's 2.6. When I create the virtualenv with the abo...
Hi,
My app needs to use PyCurl, so i tried to install it on my Mac but i found a lot of problems and error :(
Requirement:
First of all i've to say that the version of Python working on my Mac is 32 bit based, because i need to use WxPython, that needs 32 bit Python.
For doing this i used:
defaults write com.apple.versioner.python Pre...
I've performed the "Replace Method with Method Object" refactoring described by Beck.
Now, I have a class with a "run()" method and a bunch of member functions that decompose the computation into smaller units. How do I test those member functions?
My first idea is that my unit tests be basically copies of the "run()" method (with diff...
I am trying to install a python library and receive this error after downloading an egg file.
Downloading http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c7-py2.5.egg
Traceback (most recent call last):
File "setup.py", line 10, in <module>
use_setuptools(min_version=min_version)
File "/Users/tylo/Downloads/Archive...
I want to know if there would be a way to catch exceptions inside called methods.
Example:
def foo(value):
print value
foo(x)
This would throw a NameError exception, because x is not declared.
I'd like to catch this NameError exception inside foo method.
Is there a way?
...
Let's say we have
def Foo(Bar=0,Song=0):
print(Bar)
print(Song)
And I want to assign any one of the two parameters in the function with the variable sing and SongVal:
Sing = Song
SongVal = 2
So that it can be run like:
Foo(Sing=SongVal)
Where Sing would assign the Song parameter to the SongVal which is 2.
The result shou...
I am looking for a way to introspect SQLAlchemy ORM classes/entities to determine the types and other constraints (like maximum lengths) of an entity's properties.
For example, if I have a declarative class:
class User(Base):
__tablename__ = "USER_TABLE"
id = sa.Column(sa.types.Integer, primary_key=True)
fullname = sa.Colu...
Hi,
I'm use nosetests to run some tests. However, after the tests have finished running, the nosetests process just sits there, and will not exit. Is there anyway to diagnose this? Does Python have a facility similar to sending Java a kill -QUIT which will print a stack trace?
...
First: I'm running Macports. No problems with that, except:
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin
which is the value of sys.exec_prefix, for my macports python even though:
/opt/local/lib/python2.6/site-packages/
seems to be quite a logical place to put things, /opt/local being the macports --prefix, as...
How can I include the upper bound in range() function? I can't add by 1 because my for-loop looks like:
for x in range(1,math.floor(math.sqrt(x))):
y = math.sqrt(n - x * x)
But as I understand it will actually be 1 < x < M where I need 1 < x <= M Adding 1 will completely change the result.
I am trying to rewrite my old program fr...
Hi:
I am looking for a simple Russian to English word corpus. It can be as simple as a csv that lists a russian word in the first column and the equivalent English word in the second. Any ideas where I can find such a thing? Does the NLTK toolkit have something like this?
Thanks
...
I'm working on a Django app in which I want to order prints through Shutterfly's Open API:
http://www.shutterfly.com/documentation/start.sfly
So far I've been able to build the appropriate POSTs and GETs using the modules and suggested code snippets including httplib, httplib2, urllib, urllib2, mimetype, etc.
But I'm stuck on the im...
Getting attributes using minidom in Python, one uses the "attributes" property. e.g. node.attributes["id"].value
So if I have <a id="foo"></a>, that should give me "foo". node.attributes["id"] does not return the value of the named attribute, but an xml.dom.minidom.Attr instance.
But looking at the help for Attr, by doing help('xml.do...