Q_Id int64 337 49.3M | CreationDate stringlengths 23 23 | Users Score int64 -42 1.15k | Other int64 0 1 | Python Basics and Environment int64 0 1 | System Administration and DevOps int64 0 1 | Tags stringlengths 6 105 | A_Id int64 518 72.5M | AnswerCount int64 1 64 | is_accepted bool 2
classes | Web Development int64 0 1 | GUI and Desktop Applications int64 0 1 | Answer stringlengths 6 11.6k | Available Count int64 1 31 | Q_Score int64 0 6.79k | Data Science and Machine Learning int64 0 1 | Question stringlengths 15 29k | Title stringlengths 11 150 | Score float64 -1 1.2 | Database and SQL int64 0 1 | Networking and APIs int64 0 1 | ViewCount int64 8 6.81M |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2,469,849 | 2010-03-18T12:45:00.000 | 1 | 0 | 1 | 1 | python,pydev,enthought | 9,306,753 | 7 | false | 0 | 0 | I am running Python 3, so I had to make these changes to get python.exe as my interpreter.
File:
C:\EasyEclipse-for-LAMP-1.2.2.2\extensions\pydev-1.3.3\eclipse\plugins\org.python.pydev_1.3.3\PySrc\interpreterInfo.py
Edit all occurrences of "print ..." to "print(...)" (the ... is whatever is being printed), so wrap it i... | 2 | 16 | 0 | I downloaded Pydev plugin for Eclipse (3.5.2) today on Mac OSX 10.5.8. To be able to use Pydev, I need to configure the interpreter in Eclipse. I am not clear what exactly I need to do here, or what this step does. I want to make sure that when I run programs from Eclipse using Pydev, it uses the Enthought Python Distr... | Configuring Pydev Interpreter in Eclipse to use Enthought Python Distribution | 0.028564 | 0 | 0 | 20,897 |
2,469,849 | 2010-03-18T12:45:00.000 | 12 | 0 | 1 | 1 | python,pydev,enthought | 4,060,609 | 7 | false | 0 | 0 | Mac OS 10.6.4:
Selecting the interpreter as /Library/Frameworks/Python.framework/Versions/2.7/Python did not work.
I had to select /Library/Frameworks/Python.framework/Versions/2.7/bin/python | 2 | 16 | 0 | I downloaded Pydev plugin for Eclipse (3.5.2) today on Mac OSX 10.5.8. To be able to use Pydev, I need to configure the interpreter in Eclipse. I am not clear what exactly I need to do here, or what this step does. I want to make sure that when I run programs from Eclipse using Pydev, it uses the Enthought Python Distr... | Configuring Pydev Interpreter in Eclipse to use Enthought Python Distribution | 1 | 0 | 0 | 20,897 |
2,470,121 | 2010-03-18T13:31:00.000 | 0 | 1 | 0 | 0 | python,pydev | 5,761,144 | 3 | false | 1 | 0 | Well, as you didn't say what 'garbage' is showing, it's a bit hard to guess, but I believe you mean the __hash__, __str__, etc from the object class (is that it?)
If that's the case, this has been dealt in the current nightly build (the '_' methods will still appear, but with lower priority, so, the methods you're prob... | 1 | 5 | 0 | I began learning and loving python about a month ago. Dive into python, django and now Tornado is the path i followed during this time.
I chose pydev as an IDE since it seems to be the most up to date and i wanted to come back to eclipse since i'm using Netbeans for php and Java.
My question is the following:
When i wr... | Bad auto completion with python on pydev? | 0 | 0 | 0 | 1,825 |
2,470,928 | 2010-03-18T15:17:00.000 | 1 | 1 | 1 | 0 | python,dictionary,cpython | 2,473,724 | 1 | true | 0 | 0 | Observations, guesses, etc:
Same happens in Python 2.x.
dict_subscript implements the equivalent of the high_level dict.__getitem__ method and thus will be called whenever adict[somekey] appears other than on the LHS of an assignment in Python code.
PyDict_GetItem is part of the C API. Perhaps it's an oversight that it... | 1 | 1 | 0 | I am reading cpython code for python 3k and I have noticed, that __missing__ is called only when dict_subscript is called, but not when PyDict_GetItem is used. What is the difference between those two methods and when each is called? If I pass an PyObject that is a subclass of dict and has __missing__ method, how can I... | cpython: when PyDict_GetItem is called and when dict_subscript? | 1.2 | 0 | 0 | 698 |
2,470,971 | 2010-03-18T15:21:00.000 | 2 | 1 | 0 | 0 | python,sockets | 2,471,078 | 7 | false | 0 | 0 | Are you on Linux? If so, perhaps your application could run netstat -lant (or netstat -lanu if you're using UDP) and see what ports are in use. This should be faster... | 3 | 29 | 0 | I have a python server that listens on a couple sockets. At startup, I try to connect to these sockets before listening, so I can be sure that nothing else is already using that port. This adds about three seconds to my server's startup (which is about .54 seconds without the test) and I'd like to trim it down. Since I... | Fast way to test if a port is in use using Python | 0.057081 | 0 | 1 | 46,722 |
2,470,971 | 2010-03-18T15:21:00.000 | 2 | 1 | 0 | 0 | python,sockets | 2,471,762 | 7 | false | 0 | 0 | Simon B's answer is the way to go - don't check anything, just try to bind and handle the error case if it's already in use.
Otherwise you're in a race condition where some other app can grab the port in between your check that it's free and your subsequent attempt to bind to it. That means you still have to handle the... | 3 | 29 | 0 | I have a python server that listens on a couple sockets. At startup, I try to connect to these sockets before listening, so I can be sure that nothing else is already using that port. This adds about three seconds to my server's startup (which is about .54 seconds without the test) and I'd like to trim it down. Since I... | Fast way to test if a port is in use using Python | 0.057081 | 0 | 1 | 46,722 |
2,470,971 | 2010-03-18T15:21:00.000 | 14 | 1 | 0 | 0 | python,sockets | 2,471,039 | 7 | true | 0 | 0 | How about just trying to bind to the port you want, and handle the error case if the port is occupied?
(If the issue is that you might start the same service twice then don't look at open ports.)
This is the reasonable way also to avoid causing a race-condition, as @eemz said in another answer. | 3 | 29 | 0 | I have a python server that listens on a couple sockets. At startup, I try to connect to these sockets before listening, so I can be sure that nothing else is already using that port. This adds about three seconds to my server's startup (which is about .54 seconds without the test) and I'd like to trim it down. Since I... | Fast way to test if a port is in use using Python | 1.2 | 0 | 1 | 46,722 |
2,471,804 | 2010-03-18T16:57:00.000 | 20 | 0 | 1 | 0 | python,markdown,python-sphinx | 17,228,308 | 12 | false | 0 | 0 | Markdown and ReST do different things.
RST provides an object model for working with documents.
Markdown provides a way to engrave bits of text.
It seems reasonable to want to reference your bits of Markdown content from your sphinx project, using RST to stub out the overall information architecture and flow of a large... | 2 | 240 | 0 | I hate reST but love Sphinx. Is there a way that Sphinx reads Markdown instead of reStructuredText? | Using Sphinx with Markdown instead of reST | 1 | 0 | 0 | 60,619 |
2,471,804 | 2010-03-18T16:57:00.000 | 1 | 0 | 1 | 0 | python,markdown,python-sphinx | 16,430,414 | 12 | false | 0 | 0 | There is a workaround.
The sphinx-quickstart.py script generates a Makefile.
You can easily invoke Pandoc from the Makefile every time you'd like to generate the documentation in order to convert Markdown to reStructuredText. | 2 | 240 | 0 | I hate reST but love Sphinx. Is there a way that Sphinx reads Markdown instead of reStructuredText? | Using Sphinx with Markdown instead of reST | 0.016665 | 0 | 0 | 60,619 |
2,472,221 | 2010-03-18T17:56:00.000 | 0 | 1 | 1 | 0 | python | 2,472,233 | 4 | false | 0 | 0 | If you're on linux you can parse the output of the file command-line tool. | 1 | 5 | 0 | I have a folder full of files and I want to search some string inside them. The issue is that some files may be zip, exe, ogg, etc.
Can I check somehow what kind of file is it so I only open and search through txt, PHP, etc. files.
I can't rely on the file extension. | How to check if a file contains plain text? | 0 | 0 | 0 | 7,602 |
2,473,783 | 2010-03-18T22:30:00.000 | 13 | 0 | 1 | 0 | python,class,list,performance,append | 2,474,076 | 7 | false | 0 | 0 | There is nothing to circumvent: appending to a list is O(1) amortized.
A list (in CPython) is an array at least as long as the list and up to twice as long. If the array isn't full, appending to a list is just as simple as assigning one of the array members (O(1)). Every time the array is full, it is automatically dou... | 1 | 59 | 0 | I have a big file I'm reading from, and convert every few lines to an instance of an Object.
Since I'm looping through the file, I stash the instance to a list using list.append(instance), and then continue looping.
This is a file that's around ~100MB so it isn't too large, but as the list grows larger, the looping sl... | Is there a way to circumvent Python list.append() becoming progressively slower in a loop as the list grows? | 1 | 0 | 0 | 50,901 |
2,474,224 | 2010-03-19T00:14:00.000 | 0 | 1 | 1 | 0 | python,networking,programming-languages,robust | 2,475,530 | 7 | false | 0 | 0 | Python is up to the task (and better) for 1, 2 and 4.
The best solution for 3 from what you describe would probably be to make your programs really open-source with GPL or BSD like licence. This way people will edit your super-cool sources (but often experienced programmers, not just script kiddies) and build on then b... | 3 | 9 | 0 | I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I n... | Python for a hobbyist programmer ( a few questions) | 0 | 0 | 0 | 861 |
2,474,224 | 2010-03-19T00:14:00.000 | 0 | 1 | 1 | 0 | python,networking,programming-languages,robust | 2,475,188 | 7 | false | 0 | 0 | Points 1 and 2: HELL YEAH.
Point 4: kind of. Python is good at some network stuff. It's not Java or C++. Just use zlib (zip library) and pickle (serialization) for everything, and look at xmlrpclib if you need IPC.
Point 3: No. However, you can write C modules (for the performance critical, and hard-to-copy) parts of y... | 3 | 9 | 0 | I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I n... | Python for a hobbyist programmer ( a few questions) | 0 | 0 | 0 | 861 |
2,474,224 | 2010-03-19T00:14:00.000 | 6 | 1 | 1 | 0 | python,networking,programming-languages,robust | 2,474,246 | 7 | false | 0 | 0 | I think that Python is very powerful to do a lot of things, but just like Java and C++, it often depends on good third-party libraries. I come from a Java background but use Python for a lot of things, and it's been a fun ride. I've done things like statistics, and automation, not sure about the UI though that often de... | 3 | 9 | 0 | I'm a hobbyist programmer (only in TI-Basic before now), and after much, much, much debating with myself, I've decided to learn Python. I don't have a ton of free time to teach myself a hundred languages and all programming I do will be for personal use or for distributing to people who need them, so I decided that I n... | Python for a hobbyist programmer ( a few questions) | 1 | 0 | 0 | 861 |
2,474,554 | 2010-03-19T02:01:00.000 | 1 | 1 | 1 | 0 | python,objective-c,pyobjc | 2,475,334 | 2 | true | 0 | 0 | There are only two kinds of programming languages:, the truism goes, the ones every one complains about and the ones no one uses. People who want to make programs don't choose a language because it's beautiful or clean; they choose it because it is supported, available, and not so awful that you just can't use it.
Whe... | 2 | 1 | 0 | I'm a fan of clean code. I like my languages to be able to express what I'm trying to do, but I like the syntax to mirror that too.
For example, I work on a lot of programs in Objective-C for jailbroken iPhones, which patch other code using the method_setImplementation() function of the runtime. Or, in PyObjC, I have t... | Extending Python and Objective-C | 1.2 | 0 | 0 | 775 |
2,474,554 | 2010-03-19T02:01:00.000 | 2 | 1 | 1 | 0 | python,objective-c,pyobjc | 2,474,626 | 2 | false | 0 | 0 | If you don't have any experience in compiler or interpreter design my answer is an emphatic NO, it is one of the biggest challenges in computer science.
If you do have experience my answer shifts to "that is a really dumb idea."
Do you envision this becoming a large mature product that other people will want to use? I... | 2 | 1 | 0 | I'm a fan of clean code. I like my languages to be able to express what I'm trying to do, but I like the syntax to mirror that too.
For example, I work on a lot of programs in Objective-C for jailbroken iPhones, which patch other code using the method_setImplementation() function of the runtime. Or, in PyObjC, I have t... | Extending Python and Objective-C | 0.197375 | 0 | 0 | 775 |
2,476,234 | 2010-03-19T09:45:00.000 | 1 | 1 | 0 | 0 | python,twisted,xmpp,irc,fifo | 2,476,445 | 2 | false | 0 | 0 | The fifo is the problem. Read from a socket instead. This will fit info the Twisted event-driven model much better. Trying to do things outside the control of the reactor is usually the wrong approach.
---- update based on feedback that the fifo is an external constraint, not avoidable ----
OK, the central issue is tha... | 2 | 4 | 0 | Im trying to write some kind of multi protocol bot (jabber/irc) that would read messages from fifo file (one liners mostly) and then send them to irc channel and jabber contacts. So far, I managed to create two factories to connect to jabber and irc, and they seem to be working.
However, I've problem with reading the ... | Python (Twisted) - reading from fifo and sending read data to multiple protocols | 0.099668 | 0 | 1 | 1,766 |
2,476,234 | 2010-03-19T09:45:00.000 | 3 | 1 | 0 | 0 | python,twisted,xmpp,irc,fifo | 2,478,970 | 2 | false | 0 | 0 | You can read/write on a file descriptor without blocking the reactor as you do with sockets, by the way doesn't sockets use file descriptors?
In your case create a class that implements twisted.internet.interfaces.IReadDescriptor and add to reactor using twisted.internet.interfaces.IReactorFDSet.addReader. For an examp... | 2 | 4 | 0 | Im trying to write some kind of multi protocol bot (jabber/irc) that would read messages from fifo file (one liners mostly) and then send them to irc channel and jabber contacts. So far, I managed to create two factories to connect to jabber and irc, and they seem to be working.
However, I've problem with reading the ... | Python (Twisted) - reading from fifo and sending read data to multiple protocols | 0.291313 | 0 | 1 | 1,766 |
2,476,748 | 2010-03-19T11:18:00.000 | 0 | 1 | 0 | 0 | java,c#,python,c++,bit-manipulation | 2,477,111 | 7 | false | 0 | 0 | I would recommend allocating a rather large buffer (4096 bytes at least) and flush that off to disk whenever it fills up. Using a one-byte buffer usually causes bad performance. | 3 | 11 | 0 | How can I write 'one bit' into a file stream or file structure each time?
Is it possible to write to a queue and then flush it?
Is it possible with C# or Java?
This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was ... | Writing 'bits' to C++ file streams | 0 | 0 | 0 | 5,699 |
2,476,748 | 2010-03-19T11:18:00.000 | 0 | 1 | 0 | 0 | java,c#,python,c++,bit-manipulation | 2,477,157 | 7 | false | 0 | 0 | I did this once for huffman decoding and ended up writing the bits as chars and thus handling everything internally as a plain old C string.
That way you don't have to worry about the trailing byte and it's human readable as well. Also checking bits is is easier since its just a matter of addressing the char array (bi... | 3 | 11 | 0 | How can I write 'one bit' into a file stream or file structure each time?
Is it possible to write to a queue and then flush it?
Is it possible with C# or Java?
This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was ... | Writing 'bits' to C++ file streams | 0 | 0 | 0 | 5,699 |
2,476,748 | 2010-03-19T11:18:00.000 | 0 | 1 | 0 | 0 | java,c#,python,c++,bit-manipulation | 2,478,818 | 7 | false | 0 | 0 | The issue here is that many platforms do not have direct bit access. They group bits into a minimal package, often times the byte or word. Also, the protocol for stream devices does not facilitate transmission of individual bits.
The common method to deal with individual bits is to pack them into the smallest porta... | 3 | 11 | 0 | How can I write 'one bit' into a file stream or file structure each time?
Is it possible to write to a queue and then flush it?
Is it possible with C# or Java?
This was needed when trying to implement an instance of Huffman coding. I can't write bits into files, so write them to a bitset and then (when compression was ... | Writing 'bits' to C++ file streams | 0 | 0 | 0 | 5,699 |
2,476,931 | 2010-03-19T11:51:00.000 | 0 | 0 | 1 | 0 | python,list,dictionary,iterable | 4,110,683 | 5 | false | 0 | 0 | I tried both examples with no success using python 2.7
To begin I created a file in C:\goat.text using notepad
Next I tried the following
import sys
print>>"C:\goat.txt", "test"
error
AttributeError: 'str' object has no attribute 'write'
print("test", file=open('C:\goat.txt', 'w'))
SyntaxError: ("no viable alternative... | 1 | 2 | 0 | So lets say I have an incredibly nested iterable of lists/dictionaries. I would like to print them to a file as easily as possible. Why can't I just redirect print to a file?
val = print(arg)
gets a SyntaxError.
Is there a way to access stdinput?
And why does print take forever with massive strings? Bad programming... | Redirect print in Python: val = print(arg) to output mixed iterable to file | 0 | 0 | 0 | 686 |
2,477,045 | 2010-03-19T12:08:00.000 | 1 | 0 | 0 | 0 | python,image-manipulation | 2,477,074 | 3 | false | 0 | 0 | Why don't you simply store the images on the file system, and only store their references on the database. That's a lot more elegant, and won't consume loads of your database.
Also, you won't have to use any kind of binary functions to read them from the DB, saving memory and loading time.
Is there a very specific reas... | 1 | 3 | 0 | I want to store the images related to a each person's profile in the DB and retrieve them
when requested and save it as .jpg file - and display it to the users.
How could I render the image data stored in the DB as an image and store it locally?? | Storing and Retrieving Images from Database using Python | 0.066568 | 1 | 0 | 19,327 |
2,479,902 | 2010-03-19T19:01:00.000 | 0 | 0 | 1 | 0 | python,import,libraries,pep8 | 2,479,960 | 5 | false | 0 | 0 | Imports happen when the module that contains the imports gets executed or imported, not when the functions are called.
Ordinarily, I wouldn't worry about it. If you are encountering slowdowns, you might profile to see if your problem is related to this. If it is, you can check to see if your module can divided up int... | 4 | 2 | 0 | I'm just wondering, I often have really long python files and imports tend to stack quite quickly.
PEP8 says that the imports should always be written at the beginning of the file.
Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called?
Does ... | Does python import all the listed libraries? | 0 | 0 | 0 | 720 |
2,479,902 | 2010-03-19T19:01:00.000 | 1 | 0 | 1 | 0 | python,import,libraries,pep8 | 2,479,950 | 5 | false | 0 | 0 | Does it make sense to worry about
this?
No
There no reason to import libraries within the functions or classes that need them.
It's just slow because the import statement has to check to see if it's been imported once, and realize that it has been imported.
If you put this in a function that's called frequently, you... | 4 | 2 | 0 | I'm just wondering, I often have really long python files and imports tend to stack quite quickly.
PEP8 says that the imports should always be written at the beginning of the file.
Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called?
Does ... | Does python import all the listed libraries? | 0.039979 | 0 | 0 | 720 |
2,479,902 | 2010-03-19T19:01:00.000 | 0 | 0 | 1 | 0 | python,import,libraries,pep8 | 2,480,037 | 5 | false | 0 | 0 | If a function inside a module is the only one to import a given other module (say you have a function sending tweets, only if some configuration option is on), then it makes sense to import that specific module in the function.
Unless I see some profiling data proving otherwise, my guess is that the overhead of an impo... | 4 | 2 | 0 | I'm just wondering, I often have really long python files and imports tend to stack quite quickly.
PEP8 says that the imports should always be written at the beginning of the file.
Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called?
Does ... | Does python import all the listed libraries? | 0 | 0 | 0 | 720 |
2,479,902 | 2010-03-19T19:01:00.000 | 2 | 0 | 1 | 0 | python,import,libraries,pep8 | 2,479,982 | 5 | false | 0 | 0 | The best place for imports is at the top of your file. That documents the dependencies in one place and makes errors from their absence appear earlier. The import itself actually occurs at the time of the import statement, but this seldom matters much.
It is not typical that you have anything to gain by not importing a... | 4 | 2 | 0 | I'm just wondering, I often have really long python files and imports tend to stack quite quickly.
PEP8 says that the imports should always be written at the beginning of the file.
Do all the imported libraries get imported when calling a function coded in the file? Or do only the necessary libraries get called?
Does ... | Does python import all the listed libraries? | 0.07983 | 0 | 0 | 720 |
2,481,287 | 2010-03-20T00:06:00.000 | 73 | 0 | 1 | 0 | python,installation,boto | 8,191,581 | 9 | false | 0 | 0 | If necessary, install pip:
sudo apt-get install python-pip
Then install boto:
pip install -U boto | 2 | 51 | 0 | So that I am able to work with it within my python scripts? | How do I install boto? | 1 | 0 | 0 | 111,398 |
2,481,287 | 2010-03-20T00:06:00.000 | 5 | 0 | 1 | 0 | python,installation,boto | 2,481,306 | 9 | false | 0 | 0 | switch to the boto-* directory and type python setup.py install. | 2 | 51 | 0 | So that I am able to work with it within my python scripts? | How do I install boto? | 0.110656 | 0 | 0 | 111,398 |
2,481,417 | 2010-03-20T00:50:00.000 | 5 | 0 | 0 | 0 | python,boto | 6,861,411 | 2 | false | 0 | 0 | I fixed same problem at Ubuntu using apt-get install python-boto | 2 | 1 | 0 | I have installed boto like so: python setup.py install; and then when I launch my python script (that imports moduls from boto) on shell, an error like this shows up: ImportError: No module named boto.s3.connection
How to settle the matter? | Problem importing modul2s from boto | 0.462117 | 0 | 1 | 3,095 |
2,481,417 | 2010-03-20T00:50:00.000 | 2 | 0 | 0 | 0 | python,boto | 2,481,420 | 2 | false | 0 | 0 | This can happen if the Python script does not use your default python executable. Check the shebang on the first line of the script (on *nix) or the .py file association (on Windows) and run that against setup.py instead. | 2 | 1 | 0 | I have installed boto like so: python setup.py install; and then when I launch my python script (that imports moduls from boto) on shell, an error like this shows up: ImportError: No module named boto.s3.connection
How to settle the matter? | Problem importing modul2s from boto | 0.197375 | 0 | 1 | 3,095 |
2,481,421 | 2010-03-20T00:53:00.000 | 136 | 0 | 1 | 0 | python | 2,481,433 | 5 | true | 0 | 0 | len is a function to get the length of a collection. It works by calling an object's __len__ method. __something__ attributes are special and usually more than meets the eye, and generally should not be called directly.
It was decided at some point long ago getting the length of something should be a function and not a... | 1 | 138 | 0 | Is there any difference between calling len([1,2,3]) or [1,2,3].__len__()?
If there is no visible difference, what is done differently behind the scenes? | Difference between len() and .__len__()? | 1.2 | 0 | 0 | 112,175 |
2,482,270 | 2010-03-20T07:12:00.000 | 8 | 1 | 0 | 0 | python,c,unit-testing,swig | 2,489,948 | 2 | true | 0 | 1 | I think that the exact solution depends on your code. Not all libraries are easily suitable for wrapping as a DLL. If your is, then ctypes is certainly the easiest way - just make a DLL out of your library and then test it with ctypes. An added bonus is that you now have your library conveniently wrapped as a standalon... | 1 | 25 | 0 | I've got a pile of C code that I'd like to unit test using Python's unittest library (in Windows), but I'm trying to work out the best way of interfacing the C code so that Python can execute it (and get the results back). Does anybody have any experience in the easiest way to do it?
Some ideas include:
Wrapping the c... | Easiest way of unit testing C code with Python | 1.2 | 0 | 0 | 12,704 |
2,482,399 | 2010-03-20T08:19:00.000 | 0 | 1 | 0 | 0 | python,internationalization,trac | 2,482,486 | 2 | false | 0 | 0 | The stable release of trac, 0.11.X does not have support for localization. It is added in the upcoming 0.12 which is currently under development. Do you have 0.12 or did you download "latest stable" which is 0.11? In that case you will have to upgrade to get localization support.
The trac site itself appears to be runn... | 1 | 1 | 0 | How can I set default language for trac. There's nothing about i18n in trac.ini | Trac default language | 0 | 0 | 0 | 2,028 |
2,483,924 | 2010-03-20T17:06:00.000 | 0 | 1 | 1 | 0 | python,ruby,perl,module,dynamic-languages | 2,484,750 | 7 | false | 0 | 0 | Most scripting languages can handle this kind of thing (by running external programs written in other languages,) but it seems as if your best bet might be shell scripting of some kind (Windows users call this "batch scripting," but the DOS syntax is horrible and not recommended.) UNIX programmers have been freely mixi... | 4 | 1 | 0 | Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought.
To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module.
In other words, which language "just works" with the most modules? | Which dynamic language can easily use libraries from other languages? | 0 | 0 | 0 | 673 |
2,483,924 | 2010-03-20T17:06:00.000 | 3 | 1 | 1 | 0 | python,ruby,perl,module,dynamic-languages | 2,483,959 | 7 | false | 0 | 0 | If you want to plug in a Perl module, the language which is best suited for this is Perl. Perl is able to represent the semantics and capabilities of code written in Perl correctly. This really shouldn't be a shock.
If you have a self-contained program you want to call from another program in its own process, not const... | 4 | 1 | 0 | Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought.
To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module.
In other words, which language "just works" with the most modules? | Which dynamic language can easily use libraries from other languages? | 0.085505 | 0 | 0 | 673 |
2,483,924 | 2010-03-20T17:06:00.000 | 0 | 1 | 1 | 0 | python,ruby,perl,module,dynamic-languages | 2,483,997 | 7 | false | 0 | 0 | The Dynamic Language Runtime was specifically designed to allow one dynamic language to use objects and functions defined in another dynamic language. Currently Python and Ruby have DLR implementations, but I haven't heard anything about Perl.
To use the DLR you need either .NET or Mono. | 4 | 1 | 0 | Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought.
To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module.
In other words, which language "just works" with the most modules? | Which dynamic language can easily use libraries from other languages? | 0 | 0 | 0 | 673 |
2,483,924 | 2010-03-20T17:06:00.000 | 0 | 1 | 1 | 0 | python,ruby,perl,module,dynamic-languages | 2,483,932 | 7 | false | 0 | 0 | all 3 languages have very good, clear facilities for just calling any executable in a subprocess (including executables like python somethingelse.py or ruby somethingelse.rb).
use what you know best. | 4 | 1 | 0 | Tell why you think Python, Perl, Ruby, etc is easiest for plugging in modules from other languages with minimal thought.
To clarify, an example: I want to write business logic in Python, but use functionality that conveniently exists as a Perl module.
In other words, which language "just works" with the most modules? | Which dynamic language can easily use libraries from other languages? | 0 | 0 | 0 | 673 |
2,484,215 | 2010-03-20T18:30:00.000 | 4 | 0 | 1 | 0 | python,inheritance,overriding,parent | 2,484,303 | 3 | false | 0 | 0 | Using __foo names mangles the name of the method to make it more hassle to access it when you need to. I would recommend never using them, which makes things like testing go more smoothly.
There is no private in Python, and if there was, it would prevent you from doing this anyhow. (This is the point of private stuff i... | 2 | 12 | 0 | I have a private method def __pickSide(self): in a parent class that I would like to override in the child class. However, the child class still calls the inherited def __pickSide(self):. How can I override the function? The child class's function name is exactly the same as the parent's function name. | How do I override a parent class's functions in python? | 0.26052 | 0 | 0 | 15,173 |
2,484,215 | 2010-03-20T18:30:00.000 | 5 | 0 | 1 | 0 | python,inheritance,overriding,parent | 2,484,252 | 3 | false | 0 | 0 | The problem you're seeing is that the double underscores mangle the function name even in calls. This prevents polymorphism from working properly since the name it is mangled to is based on the name of the class the method is defined in, and not the name of the class of the object that is being referenced. Replacing th... | 2 | 12 | 0 | I have a private method def __pickSide(self): in a parent class that I would like to override in the child class. However, the child class still calls the inherited def __pickSide(self):. How can I override the function? The child class's function name is exactly the same as the parent's function name. | How do I override a parent class's functions in python? | 0.321513 | 0 | 0 | 15,173 |
2,484,578 | 2010-03-20T20:12:00.000 | 1 | 1 | 1 | 0 | c#,python | 2,484,600 | 10 | false | 0 | 0 | The JITer, and the fact that it can produce tighter code due to it supporting static typing. The JITer can be worked around by using one of the non-CPython implementations, or dropping to i386 and using psyco, but the static typing can't be worked around as trivially (nor do I believe that it should be). | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 0.019997 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 13 | 1 | 1 | 0 | c#,python | 2,484,624 | 10 | false | 0 | 0 | Visual Studio - the best IDE out there.
Of the statically typed languages in circulation, C# is very productive. | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 1 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 0 | 1 | 1 | 0 | c#,python | 2,484,609 | 10 | false | 0 | 0 | I've found it helpful to work with different languages, since they each have their strengths. Python is extremely powerful, but relies heavily on good coding conventions and practices to keep code maintainable. In particular, it does not enforce type safety or insulation, which means it is easy to abuse. C# is a mod... | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 0 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 9 | 1 | 1 | 0 | c#,python | 2,484,595 | 10 | true | 0 | 0 | There are lots of differences, advantages as well as disadvantages. I guess the main advantages would be along the lines of
Excellent Windows integration, including access to all standard GUI functions and other libraries.
JIT compilation, resulting in better performance than Python, in some or most circumstances. As ... | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 1.2 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 3 | 1 | 1 | 0 | c#,python | 2,485,085 | 10 | false | 0 | 0 | C# is supported by Microsoft ;) (expecting comments)
C# is typesafe which comes with its advantages.
Nothing is better when you are developing windows applications.
Its syntax is also very well designed. Code looks pretty good.
Its worth learning because lots of code is written and is being written in it.
It feels so g... | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 0.059928 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 0 | 1 | 1 | 0 | c#,python | 2,484,612 | 10 | false | 0 | 0 | Well, the ease of coding is debatable. I find C# easier to code when you factor in the help you get from teh IDEs (e.g. the free Visual Web Developer).
So, portability is less of an issue if you factor in Mono. Performance can be better in some scenarios. I find the online documentation to be generally better in .... | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 0 | 0 | 0 | 7,557 |
2,484,578 | 2010-03-20T20:12:00.000 | 0 | 1 | 1 | 0 | c#,python | 2,484,650 | 10 | false | 0 | 0 | C# can directly access pointers via "unmanaged code", which can give it a performance advantage in some situations. | 7 | 10 | 0 | I like Python mostly for the great portability and the ease of coding, but I was wondering, what are some of the advantages that C# has over Python?
The reason I ask is that one of my friends runs a private server for an online game (UO), and he offered to make me a dev if I wanted, but the software for the server is a... | what are the advantages of C# over Python | 0 | 0 | 0 | 7,557 |
2,485,901 | 2010-03-21T04:18:00.000 | 1 | 0 | 1 | 0 | python,file,import,module | 2,485,922 | 4 | false | 0 | 0 | No, this isn't redundant - it's fine to import chores in both the main module and coolfunctions.
The exact import mechanics of Python are complex (for example, module imports are only done once, meaning in your case that the actual parsing and loading of the chores module will only happen once, which is a nice optimiza... | 3 | 2 | 0 | Let's assume I have a main script, main.py, that imports another python file with import coolfunctions and another: import chores
Now, suppose coolfunctions also uses stuff from chores, hence I declare import chores inside coolfunctions.
Since both main.py, and coolfunctions import chores ~ is this redundant? Is th... | How to import modules that are used in both the main code and a module correctly? | 0.049958 | 0 | 0 | 481 |
2,485,901 | 2010-03-21T04:18:00.000 | 0 | 0 | 1 | 0 | python,file,import,module | 2,485,940 | 4 | false | 0 | 0 | It is always the best practice to import all necessary modules in the file that uses them. Take for example:
A.py contains: import coolfunctions
B.py contains: import A
Main.py contains: import B and uses functions that are defined in A.py (this is possible because by importing B, Main.py has imported everything that B... | 3 | 2 | 0 | Let's assume I have a main script, main.py, that imports another python file with import coolfunctions and another: import chores
Now, suppose coolfunctions also uses stuff from chores, hence I declare import chores inside coolfunctions.
Since both main.py, and coolfunctions import chores ~ is this redundant? Is th... | How to import modules that are used in both the main code and a module correctly? | 0 | 0 | 0 | 481 |
2,485,901 | 2010-03-21T04:18:00.000 | 1 | 0 | 1 | 0 | python,file,import,module | 2,485,978 | 4 | true | 0 | 0 | Each module X should import all (and only) the modules Y, Z, T, ... whose functionality it requires, without any worry about what other modules Fee, Fie, Foo ... (if any) may have already done part or all of those imports, or may be going to do so in the future.
It would make a module extremely fragile (indeed, it woul... | 3 | 2 | 0 | Let's assume I have a main script, main.py, that imports another python file with import coolfunctions and another: import chores
Now, suppose coolfunctions also uses stuff from chores, hence I declare import chores inside coolfunctions.
Since both main.py, and coolfunctions import chores ~ is this redundant? Is th... | How to import modules that are used in both the main code and a module correctly? | 1.2 | 0 | 0 | 481 |
2,486,348 | 2010-03-21T07:46:00.000 | 1 | 1 | 1 | 0 | python,programming-languages,interpreter | 2,487,912 | 8 | true | 0 | 0 | Numerous template languages such as Cheetah, Django templates, Genshi, Mako, Mighty might serve as an example. | 3 | 2 | 0 | i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any progra... | programming language implemented in pure python | 1.2 | 0 | 0 | 1,368 |
2,486,348 | 2010-03-21T07:46:00.000 | 0 | 1 | 1 | 0 | python,programming-languages,interpreter | 2,486,375 | 8 | false | 0 | 0 | Possibly Common Lisp (or any other Lisp) will be the best choice for that task. Because Lisp make it possible to easily extend host language with powerful macroses and construct DSL (domain specific language). | 3 | 2 | 0 | i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any progra... | programming language implemented in pure python | 0 | 0 | 0 | 1,368 |
2,486,348 | 2010-03-21T07:46:00.000 | 1 | 1 | 1 | 0 | python,programming-languages,interpreter | 2,486,403 | 8 | false | 0 | 0 | Why not Python itself? With some care you can use eval to run user code.
One of the good thing about interpreted scripting languages is that you don't need another extra scripting language! | 3 | 2 | 0 | i am creating ( researching possibility of ) a highly customizable python client and would like to allow users to actually edit the code in another language to customize the running of program. ( analogous to browser which itself coded in c/c++ and run another language html/js ). so my question is , is there any progra... | programming language implemented in pure python | 0.024995 | 0 | 0 | 1,368 |
2,486,737 | 2010-03-21T10:41:00.000 | 3 | 1 | 1 | 0 | python | 2,486,751 | 3 | false | 0 | 0 | First you can try psyco, that may give you a speed up as much as 10x, but 2x is more typical
If you can post the code up somewhere, perhaps someone can point out how to leverage numpy.
If your task doesn't map well only numpy then cython is a good choice to convert a intensive function or two into C code just by adding... | 1 | 0 | 0 | I wrote a number crunching python code. The calculations involved can take hours. Is it possible somehow to compile it to binary?
Thanks | Convert python script to binary executable | 0.197375 | 0 | 0 | 2,921 |
2,487,033 | 2010-03-21T12:22:00.000 | 1 | 0 | 1 | 0 | python,controls,port,device | 21,833,149 | 4 | false | 0 | 0 | but whatever.. someone will look for the answer at some point:
I'm on a mac (osx 10.9).. I successfully installed libusb with mac ports, but was getting the "no backend available" message. It's because python can't find the usb dylibs.
You have to add the path to your libusb to your $DYLD_LIBRARY_PATH (e.g. /opt/loc... | 1 | 7 | 0 | i am using python on ubuntu 9.04
say i have two usb devices connected to a single PC. how can i identify the devices in python code.....for example like
if usb port id == A
write data to device 1
if usb port id == B
write data to device 2
any ideas.... | usb device identification | 0.049958 | 0 | 0 | 39,244 |
2,487,410 | 2010-03-21T14:29:00.000 | 1 | 0 | 1 | 0 | debugging,ironpython | 12,800,514 | 3 | false | 1 | 0 | I love Eclipse. I learned it over several years while developing JAVA, and as soon as I found out there was a PyDev plug in that was enough for me.
I would recommend seeing if there is a plugin for what ever IDE you are most comfortable with. | 1 | 2 | 0 | Is there a good debugger for IronPython? | A debugger for IronPython | 0.066568 | 0 | 0 | 337 |
2,488,142 | 2010-03-21T18:17:00.000 | 2 | 0 | 0 | 0 | python,django,mod-python | 2,488,505 | 1 | false | 1 | 0 | There are two obvious reasons to why this might happen:
djangobb_forum is not on your Python path
There is no __init__.py in the djangobb_forum folder
If the code says from djangobb_forum import ... then you need to have the parent folder of djangobb_forum on your Python path. | 1 | 4 | 0 | I've installed Djangobb app on my server (Debian, mod_python) by cloning original source. The only things I've changed is database options in settings.py. All needed components are installed - syncdb query was executed right.
But, when I'm trying to enter on my forum, it returns me error:
ImproperlyConfigured: Error i... | Djangobb problem | 0.379949 | 0 | 0 | 1,302 |
2,488,185 | 2010-03-21T18:25:00.000 | 1 | 0 | 1 | 1 | python,pcap,packet-sniffers | 2,488,246 | 1 | true | 0 | 0 | Python 2.5 code should run fine unaltered on Python 2.6 (you'll just occasionaly get a DeprecationWarning for features which are changing in Python 3.x). | 1 | 1 | 0 | How do you end up running pypcap for python 2.6 on a mac? It seems that there hasn't been any new releases since 2.5 or am I just looking in the wrong places?
I seem to be unable to install the 2.5 binary with the following error: You cannot install pcap 1.1 on this volume. pcap requires System Python 2.5 to install. | Pypcap for mac on python 2.6? | 1.2 | 0 | 0 | 1,242 |
2,488,670 | 2010-03-21T20:55:00.000 | 1 | 0 | 1 | 0 | python,algorithm,cluster-analysis,character-encoding | 2,489,898 | 2 | false | 0 | 0 | You should be able to treat your words as numerals in a strange base. For example, let's say you have a..z as your charset (26 characters), 4 character strings, and you want to distribute among equally 10 machines. Then there are a total of 26^4 strings, so each machine gets 26^4/10 strings. The first machine will g... | 1 | 1 | 1 | My question is rather complicated for me to explain, as i'm not really good at maths, but i'll try to be as clear as possible.
I'm trying to code a cluster in python, which will generate words given a charset (i.e. with lowercase: aaaa, aaab, aaac, ..., zzzz) and make various operations on them.
I'm searching how to c... | python parallel computing: split keyspace to give each node a range to work on | 0.099668 | 0 | 0 | 260 |
2,488,710 | 2010-03-21T21:04:00.000 | 1 | 0 | 0 | 0 | python,django,django-admin,shopping-cart,django-nonrel | 2,488,729 | 3 | false | 1 | 0 | Sounds like you want two related models - Item and Option. Item would contain the name of the item, and Option would contain the option - eg size - and the price of that option. You would then set up your admin to use an inline form for Option. | 1 | 2 | 0 | Basically I am writing a simple shopping cart. Each item can have multiple prices. (i.e. shirts where each size is priced differently). I would like to have a single price field in my admin panel, where when the first price is entered, an additional price field pops up. However I am kind of at a loss as to how to do th... | django admin - adding fields on the fly | 0.066568 | 0 | 0 | 515 |
2,488,730 | 2010-03-21T21:10:00.000 | 30 | 0 | 1 | 0 | python,c++,opengl,3d,pyopengl | 2,489,409 | 5 | true | 0 | 1 | It depends a LOT on the contents of your computer graphics course. If you are doing anything like the introductory course I've taught in the past, it's basically spinning cubes and spheres, some texture mapping and some vertex animation, and that's about it. In this case, Python would be perfectly adequate, assuming yo... | 2 | 15 | 0 | I'm starting a computer graphics course, and I have to choose a language.
Choices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part.
I have heard though, that performance is an issue.
Is python / pyopengl ... | pyopengl: Could it replace c++? | 1.2 | 0 | 0 | 10,480 |
2,488,730 | 2010-03-21T21:10:00.000 | 2 | 0 | 1 | 0 | python,c++,opengl,3d,pyopengl | 2,488,775 | 5 | false | 0 | 1 | Python is an awesome language, but it's not the right tool for graphics. And if you want to do anything remotely advanced you'll have to use unpythonic libraries and will end up with ugly C code written in Python. | 2 | 15 | 0 | I'm starting a computer graphics course, and I have to choose a language.
Choices are between C++ and Python. I have no problem with C++, python is a work in progress. So i was thinking to go down the python road, using pyopengl for graphics part.
I have heard though, that performance is an issue.
Is python / pyopengl ... | pyopengl: Could it replace c++? | 0.07983 | 0 | 0 | 10,480 |
2,489,299 | 2010-03-21T23:54:00.000 | 0 | 1 | 1 | 0 | python,python-3.x | 2,490,394 | 5 | false | 0 | 0 | More iterators (in things like dict.keys()) will be a big boost for web applications.
The core team will put more work into the new version. New books might focus on python 3 (see Dive into Python), but the real work is still done in python 2.
Sooner or later, the big libraries (numpy, wx, django) will be ported. Until... | 3 | 23 | 0 | I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3? | Will Python 3 ever catch on? | 0 | 0 | 0 | 5,413 |
2,489,299 | 2010-03-21T23:54:00.000 | 32 | 1 | 1 | 0 | python,python-3.x | 2,489,398 | 5 | true | 0 | 0 | On the whole, and even in most details, Python3 is better than Python2.
The only area where Python 3 is lagging is with regards to 3rd party libraries. What makes Python great is not only its intrinsic characteristics as a language and its rather extensive standard library, but also the existence of a whole "eco-syste... | 3 | 23 | 0 | I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3? | Will Python 3 ever catch on? | 1.2 | 0 | 0 | 5,413 |
2,489,299 | 2010-03-21T23:54:00.000 | 6 | 1 | 1 | 0 | python,python-3.x | 2,489,395 | 5 | false | 0 | 0 | The main thing holding Python 3.x back right now is the lack of third-party libraries. I'll be converting my code as soon as SciPy gets ported. | 3 | 23 | 0 | I have been learning a bit of Python 2 and Python 3 and it seems like Python 2 is overall better than Python 3. So that's where my question comes in. Are there any good reasons to actually switch over to python 3? | Will Python 3 ever catch on? | 1 | 0 | 0 | 5,413 |
2,489,435 | 2010-03-22T00:48:00.000 | 1 | 1 | 1 | 0 | python,math,perfect-square | 2,489,474 | 24 | false | 0 | 0 | You could binary-search for the rounded square root. Square the result to see if it matches the original value.
You're probably better off with FogleBirds answer - though beware, as floating point arithmetic is approximate, which can throw this approach off. You could in principle get a false positive from a large inte... | 2 | 103 | 0 | How could I check if a number is a perfect square?
Speed is of no concern, for now, just working. | Check if a number is a perfect square | 0.008333 | 0 | 0 | 193,572 |
2,489,435 | 2010-03-22T00:48:00.000 | -1 | 1 | 1 | 0 | python,math,perfect-square | 2,489,814 | 24 | false | 0 | 0 | Decide how long the number will be.
take a delta 0.000000000000.......000001
see if the (sqrt(x))^2 - x is greater / equal /smaller than delta and decide based on the delta error. | 2 | 103 | 0 | How could I check if a number is a perfect square?
Speed is of no concern, for now, just working. | Check if a number is a perfect square | -0.008333 | 0 | 0 | 193,572 |
2,489,620 | 2010-03-22T02:01:00.000 | 2 | 0 | 0 | 0 | python,django,inheritance,django-models,django-orm | 2,489,866 | 4 | false | 1 | 0 | I agree about the roles solution, as depicted by Alex. What you have is not different subclasses of persons. You have different roles a person can have.
But I hear you say: "hey, the ninja can have a property "numberOfStars", while a singer can have a property "highestNote". Same as for the interface: a ninja can have ... | 2 | 14 | 0 | I think this is a bit tricky, at least for me. :)
So I have 4 models Person, Singer, Bassist and Ninja.
Singer, Bassist and Ninja inherit from Person.
The problem is that each Person can be any of its subclasses.
e.g. A person can be a Singer and a Ninja. Another Person can be a Bassist and a Ninja. Another one can b... | Tricky model inheritance - Django | 0.099668 | 0 | 0 | 2,669 |
2,489,620 | 2010-03-22T02:01:00.000 | 1 | 0 | 0 | 0 | python,django,inheritance,django-models,django-orm | 16,554,051 | 4 | false | 1 | 0 | You could make all your professions (Ninja, Bassist....) inherit from Person in the models, and then use the function isinstance in the backend code to distinguish between the professions of a Person. | 2 | 14 | 0 | I think this is a bit tricky, at least for me. :)
So I have 4 models Person, Singer, Bassist and Ninja.
Singer, Bassist and Ninja inherit from Person.
The problem is that each Person can be any of its subclasses.
e.g. A person can be a Singer and a Ninja. Another Person can be a Bassist and a Ninja. Another one can b... | Tricky model inheritance - Django | 0.049958 | 0 | 0 | 2,669 |
2,489,643 | 2010-03-22T02:08:00.000 | 1 | 0 | 0 | 0 | python,qt4,pyqt4,qt-designer | 2,494,652 | 4 | false | 0 | 1 | You can run pyuic (or rather pyuic4) from hand, in your console. You can make your GUI using designer with Python, just as you would do it with C++.
By the way: I have written all GUI stuff for my app (10k of code) by hand. I don't really like GUI designers and working with generated code, when you need to tweak someth... | 2 | 20 | 0 | I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6
I just downloaded the whole PyQT/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to use as a newbie (since you can see all the attributes/properties/defau... | Using QTDesigner with PyQT and Python 2.6 | 0.049958 | 0 | 0 | 11,299 |
2,489,643 | 2010-03-22T02:08:00.000 | 0 | 0 | 0 | 0 | python,qt4,pyqt4,qt-designer | 3,595,979 | 4 | false | 0 | 1 | QtDesigner uses uic.exe to generate on the fly C++ code. uic.exe is a command-line tool, it gets file names as input parameters. For integration with python, you can write a python program that uses pyuic.py, match it inputs with uic.exe's input (order, switchs etc.), convert it to an executable (using py2exe) and rena... | 2 | 20 | 0 | I'm new to Python and am starting to teach myself GUI programming (hopefully) using PyQT4.7 and Python 2.6
I just downloaded the whole PyQT/QT4 package (including QTDesigner) from the PyQT website, however it seems QTDesigner, which looks amazing to use as a newbie (since you can see all the attributes/properties/defau... | Using QTDesigner with PyQT and Python 2.6 | 0 | 0 | 0 | 11,299 |
2,490,150 | 2010-03-22T05:27:00.000 | 0 | 1 | 0 | 0 | python,cgi | 2,490,241 | 2 | false | 0 | 0 | There are a number of Python web frameworks which make this easier for you. Django, for example, has a built-in web server designed for testing out your application.
However, if you're already using CGI, the easiest way to test it would be to run Apache. Configuring CGI for Apache is straightforward and there is a lo... | 1 | 0 | 0 | Just wondering whats the best way to test Python CGI while developing a site?
(I'm used to PHP for web dev so bear with me :P) | Best/Fastest Way to Test Python CGI locally? | 0 | 0 | 0 | 893 |
2,490,291 | 2010-03-22T06:07:00.000 | 0 | 1 | 0 | 1 | java,python,file-io | 2,490,299 | 1 | true | 1 | 0 | Performance-wise, for an I/O - syscall bound task such as you're mentioning, it's going to be a wash, most likely, depending a bit on the platform. Java tends to have better CPU usage (partly because a JVM can effectively use multiple cores on a multicore CPU on different threads, with CPython having problems with tha... | 1 | 1 | 0 | I need to create daemon that will monitor certain directory and will process every file that's written to that particular path.
My choice is either java or python.
Did you guys have any experience using both technology? what is the best one?
EDIT 1: files that will be processed is simple text file (one line with tab s... | Performance Wise, Python VS JAVA For File Based Processing | 1.2 | 0 | 0 | 1,498 |
2,490,592 | 2010-03-22T07:36:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine | 2,491,775 | 3 | false | 1 | 0 | Why not rewrite what your php script does in python?
Php is a awful scripting language, and considering your thinking about calling it from inside a very powerful language, why not do it all in python | 1 | 1 | 0 | I wanto call a PHP script using Google App Engine. I just want to execute the script. The script updates a couple of databases on my webhost. But I guess Google App waits for the response. Is there a way by which I can start the script.
The script takes some time and Google App might die during that time. | Use URL Fetch of Google App Engine just to call a php script | 0 | 0 | 0 | 658 |
2,490,686 | 2010-03-22T08:04:00.000 | 2 | 0 | 1 | 0 | python,tabs,indentation,spaces | 2,490,727 | 4 | false | 0 | 0 | This is something your editor should do for you. Most editors (try Notepad++ for example, it's free) will let you set whether hitting tab enters a tab character or a number of spaces. I'd recommend using two spaces instead of tab in all files (I find 4 is too much). Using spaces instead of tabs is better as it means th... | 1 | 4 | 0 | In Python, is there a mean to enforce the use of spaces or tabs indentation with a per file basis ?
Well, perhaps "enforce" is too strong, more like a "recommendation".
I keep receiving patch files with mixed indentation and this is annoying... (to say the least) Python itself can tell when there is a problem, but I a... | Enforce "spaces" or "tabs" only in python files? | 0.099668 | 0 | 0 | 3,387 |
2,490,715 | 2010-03-22T08:11:00.000 | 5 | 1 | 1 | 0 | python,unit-testing | 2,490,736 | 4 | false | 0 | 0 | If you make functional programming then the unit is the function and I would recommend to unit test your functions | 1 | 4 | 0 | Hey - I'm new to python , and I'm having a hard time grasping the concept of Unit testing in python.
I'm coming from Java - so unit testing makes sense because - well , there you actually have a unit - A Class. But a Python class is not necessarily the same as a Java class , and the way I use Python - as a scripting la... | Unit testing in python? | 0.244919 | 0 | 0 | 941 |
2,491,222 | 2010-03-22T09:59:00.000 | -2 | 0 | 1 | 0 | python,file-rename | 65,256,950 | 17 | false | 0 | 0 | os.chdir(r"D:\Folder1\Folder2")
os.rename(src,dst)
#src and dst should be inside Folder2 | 1 | 585 | 0 | I want to change a.txt to b.kml. | How to rename a file using Python | -0.023525 | 0 | 0 | 588,101 |
2,491,280 | 2010-03-22T10:08:00.000 | 0 | 0 | 0 | 1 | python,django,google-app-engine | 2,492,830 | 3 | false | 1 | 0 | Re virtualenv question above: virtualenv have a parameter
--python=PYTHON_EXE that you can point to the interpreter you'd like
it to use. Running virtualenv without parameters or with an --help
option whill show you which options you may pass it. | 2 | 2 | 0 | On my development system, I have Python 2.6, Django 1.1 and GAE.
I have three projects running on Python 2.6 and Django 1.1.
I have 1 project using GAE, Python 2.6 and Django 1.1.
I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the producti... | GAE, Python 2.5, Python 2.6 Side-by-side on windows | 0 | 0 | 0 | 470 |
2,491,280 | 2010-03-22T10:08:00.000 | 0 | 0 | 0 | 1 | python,django,google-app-engine | 2,491,639 | 3 | false | 1 | 0 | Unless you are using python 2.6 specific syntax/code your application is safe to run on GAE. | 2 | 2 | 0 | On my development system, I have Python 2.6, Django 1.1 and GAE.
I have three projects running on Python 2.6 and Django 1.1.
I have 1 project using GAE, Python 2.6 and Django 1.1.
I have heard that my set-up for running GAE using Python 2.6 may create some head-scratching problems while deploying it on the producti... | GAE, Python 2.5, Python 2.6 Side-by-side on windows | 0 | 0 | 0 | 470 |
2,491,819 | 2010-03-22T11:35:00.000 | 9 | 0 | 1 | 0 | python,class,init | 2,491,843 | 12 | false | 0 | 0 | __init__ doesn't return anything and should always return None. | 1 | 140 | 0 | I have a class with an __init__ function.
How can I return an integer value from this function when an object is created?
I wrote a program, where __init__ does command line parsing and I need to have some value set. Is it OK set it in global variable and use it in other member functions? If so how to do that? So far,... | How to return a value from __init__ in Python? | 1 | 0 | 0 | 195,099 |
2,492,490 | 2010-03-22T13:23:00.000 | 1 | 0 | 0 | 0 | java,python,xml,marshalling,interop | 2,492,599 | 2 | true | 1 | 0 | As Ignacio says, XML is XML. On the python side, I recommend using lxml, unless you have more specific needs that are better met by another library. If you are restricted to the standard library, look at ElementTree or cElementTree, which are also excellent, and which inspired (and are functionally mostly equivalent ... | 1 | 2 | 0 | I need a recommendation for a pythonic library that can marshall python objects to XML(let it be a file).
I need to be able read that XML later on with Java (JAXB) and unmarshall it.
I know JAXB has some issues that makes it not play nice with .NET XML libraries so a recommendation on something that actually works woul... | Python XML + Java XML interoperability | 1.2 | 0 | 1 | 475 |
2,493,425 | 2010-03-22T15:23:00.000 | 2 | 0 | 1 | 0 | python,list,dictionary,tuples | 2,493,499 | 3 | true | 0 | 0 | You can add a list to a tuple just like any other element. From a dictionary, you can access each element of the tuple by indexing it like so: d[key][0] and d[key][1]. Here is an example:
>>> d = {}
>>> d["b"] = ('b', [2])
>>> d["a"] = ('a', [1])
>>> for k in d:
... print(d[k][0], d[k][1])
...
('a', [1])
('b', [2]... | 1 | 0 | 0 | How can i have a tuple that has a list as a value.
F.x. if i want to have a structure like this.
( Somechar , Somelist[] )
And how would i iterate through a dictionary of these things? | Dictionaries with tuples that have lists as values | 1.2 | 0 | 0 | 221 |
2,493,732 | 2010-03-22T16:01:00.000 | 1 | 0 | 1 | 0 | python,finance,google-finance,stock | 2,493,791 | 3 | false | 0 | 0 | That will be hard to impossible. Little of this is exchange-traded (i.e. public) and even if it were, exchanges are unlikely to give data away for free. Sales of data now comprise more than half of total revenue for a number of exchanges. | 1 | 4 | 0 | I am looking for a resource to download fixed income data online, much like there is access to stock data from yahoo. At the very least I'd like the treasury bonds.
I use python, but any help would be appreciated. | Fixed income data online | 0.066568 | 0 | 0 | 2,698 |
2,494,288 | 2010-03-22T17:18:00.000 | 0 | 0 | 0 | 0 | python,ctypes | 2,494,539 | 2 | false | 0 | 1 | You can also use ctypes.cast(buf, ctypes.c_void_p) | 1 | 5 | 0 | I am dealing with image buffers, and I want to be able to access data a few lines into my image for analysis with a c library. I have created my 8-bit pixel buffer in Python using create_string_buffer. Is there a way to get a pointer to a location within that buffer without re-creating a new buffer? My goal is to an... | ctypes and pointer manipulation | 0 | 0 | 0 | 3,210 |
2,494,468 | 2010-03-22T17:43:00.000 | 0 | 1 | 1 | 0 | python,c,dll,distribution | 2,540,638 | 6 | false | 0 | 1 | There's a program called py2exe. I don't know if it's only available for Windows. Also, the latest version that I used does not wrap everything up into one .exe file. It creates a bunch of stuff that has to be distributed - a zip file, etc.. | 1 | 11 | 0 | Hello fellow software developers.
I want to distribute a C program which is scriptable by embedding the Python interpreter.
The C program uses Py_Initialize, PyImport_Import and so on to accomplish Python embedding.
I'm looking for a solution where I distribute only the following components:
my program executable an... | How to create an application which embeds and runs Python code without local Python installation? | 0 | 0 | 0 | 5,060 |
2,494,508 | 2010-03-22T17:49:00.000 | 1 | 0 | 1 | 0 | python,nlp | 2,494,560 | 6 | false | 0 | 0 | If neos recommendation is also unpractical, I would try something like this:
In many languages there are some keywords which are in many sentences and are often not found in other languages.
Example: "The" in English, "der", "die", "das" in German, ....
Find such words and try to find them in your texts. It can be a li... | 1 | 20 | 0 | I have a list of articles, and each article has its own title and description. Unfortunately, from the sources I am using, there is no way to know what language they are written in.
Furthermore, the text is not entirely written in 1 language; almost always English words are present.
I reckon I would need dictionary dat... | Recognizing language of a short text? | 0.033321 | 0 | 0 | 6,940 |
2,495,350 | 2010-03-22T20:09:00.000 | 7 | 1 | 0 | 0 | python,ruby-on-rails,artificial-intelligence,prolog | 2,497,026 | 5 | false | 1 | 0 | The selection of language is completely irrelevant, all other things being equal.
If you're trying to do X and there's a library for it in language Y and meshes well with your Web-based framework, then use it.
Without knowing more about what specific areas of AI you're interested in, the question is far too vague to be... | 2 | 4 | 0 | A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environ... | Python or Ruby for webbased Artificial Intelligence? | 1 | 0 | 0 | 3,942 |
2,495,350 | 2010-03-22T20:09:00.000 | 0 | 1 | 0 | 0 | python,ruby-on-rails,artificial-intelligence,prolog | 2,498,323 | 5 | false | 1 | 0 | You could also use Scala (which is a bit functional and runs on the JVW) and the existing Lift framework for web-stuff. | 2 | 4 | 0 | A new web application may require adding Artificial Intelligence (AI) in the future, e.g. using ProLog. I know it can be done from a Java environment, but I am wondering about the opportunities with modern web languages like Ruby or Python. The latter is considered to be "more scientific" (at least used in that environ... | Python or Ruby for webbased Artificial Intelligence? | 0 | 0 | 0 | 3,942 |
2,497,449 | 2010-03-23T03:47:00.000 | 4 | 0 | 1 | 0 | python,matplotlib | 2,497,667 | 5 | false | 0 | 0 | Why not just make the x value some auto-incrementing number and then change the label?
--jed | 1 | 11 | 1 | I am using matplotlib for a graphing application. I am trying to create a graph which has strings as the X values. However, the using plot function expects a numeric value for X.
How can I use string X values? | Plot string values in matplotlib | 0.158649 | 0 | 0 | 48,768 |
2,498,009 | 2010-03-23T06:36:00.000 | 4 | 1 | 1 | 0 | java,.net,c++,python,encryption | 2,498,054 | 6 | true | 0 | 0 | How can I accomplish this, and WHAT IS
the BEST encryption way to do it, if
applicable?
tar and gzip the directory.
Generate a random bit stream of equal size to the file
Run bitwise XOR on the streams
Only truly secure method is a truly random one time pad. | 2 | 4 | 0 | I need to programatically encrypt a directory of files, like in a .zip or whatever. Preferably password protected obviously.
How can I accomplish this, and WHAT IS the BEST encryption way to do it, if applicable?
Programming language doesn't matter. I am dictioned in all syntax. | Best way to encrypt a directory of files? | 1.2 | 0 | 0 | 4,494 |
2,498,009 | 2010-03-23T06:36:00.000 | 3 | 1 | 1 | 0 | java,.net,c++,python,encryption | 2,498,034 | 6 | false | 0 | 0 | I still say 7-zip is the answer. It hasn't been "cracked". | 2 | 4 | 0 | I need to programatically encrypt a directory of files, like in a .zip or whatever. Preferably password protected obviously.
How can I accomplish this, and WHAT IS the BEST encryption way to do it, if applicable?
Programming language doesn't matter. I am dictioned in all syntax. | Best way to encrypt a directory of files? | 0.099668 | 0 | 0 | 4,494 |
2,499,491 | 2010-03-23T11:37:00.000 | 1 | 0 | 1 | 0 | python,memory,buffer | 2,500,096 | 8 | false | 0 | 0 | You can also set up persistent shared memory area and have one program write to it and the other read it. However, setting up such things is somewhat dependent on the underlying O/S. | 4 | 1 | 0 | Let's imagine a situation: I have two Python programs. The first one will write some data (str) to computer memory, and then exit. I will then start the second program which will read the in-memory data saved by the first program.
Is this possible? | Reading and writing to/from memory in Python | 0.024995 | 0 | 0 | 4,514 |
2,499,491 | 2010-03-23T11:37:00.000 | 1 | 0 | 1 | 0 | python,memory,buffer | 2,499,513 | 8 | false | 0 | 0 | No.
Once the first program exits, its memory is completely gone.
You need to write to disk. | 4 | 1 | 0 | Let's imagine a situation: I have two Python programs. The first one will write some data (str) to computer memory, and then exit. I will then start the second program which will read the in-memory data saved by the first program.
Is this possible? | Reading and writing to/from memory in Python | 0.024995 | 0 | 0 | 4,514 |
2,499,491 | 2010-03-23T11:37:00.000 | 2 | 0 | 1 | 0 | python,memory,buffer | 2,499,521 | 8 | false | 0 | 0 | Store you data into "memory" using things like databases, eg dbm, sqlite, shelve, pickle, etc where your 2nd program can pick up later. | 4 | 1 | 0 | Let's imagine a situation: I have two Python programs. The first one will write some data (str) to computer memory, and then exit. I will then start the second program which will read the in-memory data saved by the first program.
Is this possible? | Reading and writing to/from memory in Python | 0.049958 | 0 | 0 | 4,514 |
2,499,491 | 2010-03-23T11:37:00.000 | 1 | 0 | 1 | 0 | python,memory,buffer | 2,499,529 | 8 | false | 0 | 0 | The first one will write some data
(str) to computer memory, and then
exit.
The OS will then ensure all that memory is zeroed before any other program can see it. (This is an important security measure, as the first program may have been processing your bank statement or may have had your password).
You need to w... | 4 | 1 | 0 | Let's imagine a situation: I have two Python programs. The first one will write some data (str) to computer memory, and then exit. I will then start the second program which will read the in-memory data saved by the first program.
Is this possible? | Reading and writing to/from memory in Python | 0.024995 | 0 | 0 | 4,514 |
2,501,457 | 2010-03-23T15:58:00.000 | 389 | 0 | 1 | 0 | python,data-structures,heap,recursive-datastructures | 2,501,527 | 19 | false | 0 | 0 | The easiest way is to invert the value of the keys and use heapq. For example, turn 1000.0 into -1000.0 and 5.0 into -5.0. | 3 | 362 | 0 | Python includes the heapq module for min-heaps, but I need a max heap. What should I use for a max-heap implementation in Python? | What do I use for a max-heap implementation in Python? | 1 | 0 | 0 | 215,327 |
2,501,457 | 2010-03-23T15:58:00.000 | 55 | 0 | 1 | 0 | python,data-structures,heap,recursive-datastructures | 44,352,853 | 19 | false | 0 | 0 | The easiest and ideal solution
Multiply the values by -1
There you go. All the highest numbers are now the lowest and vice versa.
Just remember that when you pop an element to multiply it with -1 in order to get the original value again. | 3 | 362 | 0 | Python includes the heapq module for min-heaps, but I need a max heap. What should I use for a max-heap implementation in Python? | What do I use for a max-heap implementation in Python? | 1 | 0 | 0 | 215,327 |
2,501,457 | 2010-03-23T15:58:00.000 | 5 | 0 | 1 | 0 | python,data-structures,heap,recursive-datastructures | 2,501,572 | 19 | false | 0 | 0 | If you are inserting keys that are comparable but not int-like, you could potentially override the comparison operators on them (i.e. <= become > and > becomes <=). Otherwise, you can override heapq._siftup in the heapq module (it's all just Python code, in the end). | 3 | 362 | 0 | Python includes the heapq module for min-heaps, but I need a max heap. What should I use for a max-heap implementation in Python? | What do I use for a max-heap implementation in Python? | 0.052583 | 0 | 0 | 215,327 |
2,501,492 | 2010-03-23T16:02:00.000 | 4 | 0 | 0 | 0 | python,ironpython | 2,501,635 | 1 | true | 0 | 0 | If you are writing "100% pure Python", you can do everything that CPython can do in IronPython. The problem comes in when you want to use a third-party package. Many of them will have written their performance-intensive portions in C, and rely on the Python/C API (e.g. NumPy).
As a glue language for hooking together ... | 1 | 5 | 0 | What can be done in Cpython that can not be done in IronPython? | What can be done in Cpython that can not be done in IronPython? | 1.2 | 0 | 0 | 233 |
2,502,243 | 2010-03-23T17:40:00.000 | 0 | 0 | 1 | 0 | python,packet-capture,pcap | 9,111,171 | 2 | false | 0 | 0 | You could also try
sudo apt-get install libpcap-dev | 1 | 2 | 0 | When I check the attributes available to the module pcap, I expect to see something like
[ ...snip...
'dltvalue', 'findalldevs',
'lookupdev', 'lookupnet', 'ntoa',
'pcapObject', 'pcapObjectPtr']
With note on pcapObject. However, all I get when running dir(pcap) is
[ ... snip... 'copyright',
'doc', 'file', 'license',... | missing elements from pcap? | 0 | 0 | 0 | 2,330 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.