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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
56,011 | 2008-09-11T08:18:00.000 | 2 | 0 | 1 | 0 | python,coding-style | 104,842 | 19 | false | 0 | 0 | It's probably a stylistic preference more than anything. I just checked PEP 8 and didn't see any mention of single versus double quotes.
I prefer single quotes because its only one keystroke instead of two. That is, I don't have to mash the shift key to make single quote. | 12 | 718 | 0 | According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other? | Single quotes vs. double quotes in Python | 0.02105 | 0 | 0 | 712,544 |
56,011 | 2008-09-11T08:18:00.000 | 2 | 0 | 1 | 0 | python,coding-style | 3,179,568 | 19 | false | 0 | 0 | In Perl you want to use single quotes when you have a string which doesn't need to interpolate variables or escaped characters like \n, \t, \r, etc.
PHP makes the same distinction as Perl: content in single quotes will not be interpreted (not even \n will be converted), as opposed to double quotes which can contain va... | 12 | 718 | 0 | According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other? | Single quotes vs. double quotes in Python | 0.02105 | 0 | 0 | 712,544 |
56,417 | 2008-09-11T12:29:00.000 | 2 | 0 | 0 | 1 | python,erp,dabo | 103,212 | 2 | false | 1 | 0 | I have no Dabo experience at all but this question is on the top of the list fo such a long time that I decided to give it a shot:
Framework selection
Assumptions:
medium-to-big project: we're talking about a team of more than 20 people working on something for about a year for the first phase. This is usually an expe... | 1 | 21 | 0 | We're at the beginning of a new ERP-ish client-server application, developed as a Python rich client. We're currently evaluating Dabo as our main framework and it looks quite nice and easy to use, but I was wondering, has anyone used it for medium-to-big sized projects?
Thanks for your time! | Anyone used Dabo for a medium-big project? | 0.197375 | 0 | 0 | 4,033 |
58,294 | 2008-09-12T04:21:00.000 | 9 | 0 | 0 | 0 | python,sockets | 58,296 | 9 | true | 0 | 0 | This isn't possible without cooperation from an external server, because there could be any number of NATs between you and the other computer. If it's a custom protocol, you could ask the other system to report what address it's connected to. | 2 | 10 | 0 | When I call socket.getsockname() on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this? | How do I get the external IP of a socket in Python? | 1.2 | 0 | 1 | 19,360 |
58,294 | 2008-09-12T04:21:00.000 | 2 | 0 | 0 | 0 | python,sockets | 256,358 | 9 | false | 0 | 0 | import socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect(("msn.com",80))
s.getsockname() | 2 | 10 | 0 | When I call socket.getsockname() on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this? | How do I get the external IP of a socket in Python? | 0.044415 | 0 | 1 | 19,360 |
60,152 | 2008-09-12T23:28:00.000 | 0 | 1 | 0 | 0 | python,linux,firefox,ubuntu,automation | 60,218 | 8 | false | 0 | 0 | The languages of choice of Firefox is Javascript. Unless you have a specific requirement that requires Python, I would advice you to use that. | 2 | 12 | 0 | Been scouring the net for something like firewatir but for python. I'm trying to automate firefox on linux. Any suggestions? | Automate firefox with python? | 0 | 0 | 1 | 21,896 |
60,152 | 2008-09-12T23:28:00.000 | 1 | 1 | 0 | 0 | python,linux,firefox,ubuntu,automation | 7,610,441 | 8 | false | 0 | 0 | I would suggest you to use Selenium instead of Mechanize/Twill because Mechanize would fail while handling Javascript. | 2 | 12 | 0 | Been scouring the net for something like firewatir but for python. I'm trying to automate firefox on linux. Any suggestions? | Automate firefox with python? | 0.024995 | 0 | 1 | 21,896 |
60,352 | 2008-09-13T05:51:00.000 | 7 | 0 | 1 | 0 | python,version-control,distutils | 60,431 | 2 | false | 0 | 0 | In Python, __init__.py files actually have a meaning! They mean that the folder they are in is a Python module. As such, they have a real role in your code and should most probably be stored in Version Control.
You could well imagine a folder in your source tree that is NOT a Python module, for example a folder contain... | 1 | 0 | 0 | If all of my __init__.py files are empty, do I have to store them into version control, or is there a way to make distutils create empty __init__.py files during installation? | Can distutils create empty __init__.py files? | 1 | 0 | 0 | 1,565 |
60,446 | 2008-09-13T09:56:00.000 | 9 | 0 | 0 | 0 | python,windows-mobile | 60,945 | 4 | false | 0 | 1 | (I used to write customer apps for Windows Mobile.)
Forget about python. Even if it's technically possible:
your app will be big (you'll have to bundle the whole python runtime with your app)
your app will use lots of memory (python is a memory hog, relative to C/C++)
your app will be slow
you wont find any documentat... | 1 | 4 | 0 | What is the best way to start developing Windows Mobile Professional applications in Python? Is there a reasonable SDK including an emulator? Is it even possible without doing excessive amount of underlaying Windows API calls for UI for instance? | Windows Mobile development in Python | 1 | 0 | 0 | 7,815 |
60,848 | 2008-09-13T20:38:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 103,211 | 11 | false | 0 | 0 | It's not possible unless you store the keys in a separate list for referencing later. | 4 | 65 | 0 | Is it possible to retrieve items from a Python dictionary in the order that they were inserted? | How do you retrieve items from a dictionary in the order that they're inserted? | 0 | 0 | 0 | 47,709 |
60,848 | 2008-09-13T20:38:00.000 | 5 | 0 | 1 | 0 | python,dictionary | 65,991 | 11 | false | 0 | 0 | Or, just make the key a tuple with time.now() as the first field in the tuple.
Then you can retrieve the keys with dictname.keys(), sort, and voila!
Gerry | 4 | 65 | 0 | Is it possible to retrieve items from a Python dictionary in the order that they were inserted? | How do you retrieve items from a dictionary in the order that they're inserted? | 0.090659 | 0 | 0 | 47,709 |
60,848 | 2008-09-13T20:38:00.000 | 5 | 0 | 1 | 0 | python,dictionary | 60,852 | 11 | false | 0 | 0 | You can't do this with the base dict class -- it's ordered by hash. You could build your own dictionary that is really a list of key,value pairs or somesuch, which would be ordered. | 4 | 65 | 0 | Is it possible to retrieve items from a Python dictionary in the order that they were inserted? | How do you retrieve items from a dictionary in the order that they're inserted? | 0.090659 | 0 | 0 | 47,709 |
60,848 | 2008-09-13T20:38:00.000 | -1 | 0 | 1 | 0 | python,dictionary | 64,266 | 11 | false | 0 | 0 | if you don't need the dict functionality, and only need to return tuples in the order you've inserted them, wouldn't a queue work better? | 4 | 65 | 0 | Is it possible to retrieve items from a Python dictionary in the order that they were inserted? | How do you retrieve items from a dictionary in the order that they're inserted? | -0.01818 | 0 | 0 | 47,709 |
61,151 | 2008-09-14T05:41:00.000 | 1 | 1 | 1 | 0 | python,unit-testing,code-organization | 61,820 | 18 | false | 0 | 0 | In C#, I've generally separated the tests into a separate assembly.
In Python -- so far -- I've tended to either write doctests, where the test is in the docstring of a function, or put them in the if __name__ == "__main__" block at the bottom of the module. | 4 | 545 | 0 | If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best pr... | Where do the Python unit tests go? | 0.011111 | 0 | 0 | 112,049 |
61,151 | 2008-09-14T05:41:00.000 | 0 | 1 | 1 | 0 | python,unit-testing,code-organization | 63,645 | 18 | false | 0 | 0 | When writing a package called "foo", I will put unit tests into a separate package "foo_test". Modules and subpackages will then have the same name as the SUT package module. E.g. tests for a module foo.x.y are found in foo_test.x.y. The __init__.py files of each testing package then contain an AllTests suite that incl... | 4 | 545 | 0 | If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best pr... | Where do the Python unit tests go? | 0 | 0 | 0 | 112,049 |
61,151 | 2008-09-14T05:41:00.000 | -2 | 1 | 1 | 0 | python,unit-testing,code-organization | 61,518 | 18 | false | 0 | 0 | I've recently started to program in Python, so I've not really had chance to find out best practice yet.
But, I've written a module that goes and finds all the tests and runs them.
So, I have:
app/
appfile.py
test/
appfileTest.py
I'll have to see how it goes as I progress to larger projects. | 4 | 545 | 0 | If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best pr... | Where do the Python unit tests go? | -0.022219 | 0 | 0 | 112,049 |
61,151 | 2008-09-14T05:41:00.000 | 13 | 1 | 1 | 0 | python,unit-testing,code-organization | 61,168 | 18 | false | 0 | 0 | I don't believe there is an established "best practice".
I put my tests in another directory outside of the app code. I then add the main app directory to sys.path (allowing you to import the modules from anywhere) in my test runner script (which does some other stuff as well) before running all the tests. This way I n... | 4 | 545 | 0 | If you're writing a library, or an app, where do the unit test files go?
It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing.
Is there a best pr... | Where do the Python unit tests go? | 1 | 0 | 0 | 112,049 |
61,556 | 2008-09-14T18:58:00.000 | 1 | 1 | 1 | 0 | spell-checking,mod-python,aspell | 61,570 | 1 | false | 0 | 0 | Looks like RHEL4 is the culprit. Works well on Fedore 7 (the version of apache is newer and there is no crash) | 1 | 0 | 0 | What is the best available method for developing a spell check engine (for example, with aspell_python), that works with apache mod_python?
apache 2.0.59+RHEL4+mod_python+aspell_python seems to crash.
Is there any alternative to using aspell_python? | Spell Checking Service with python using mod_python | 0.197375 | 0 | 0 | 238 |
62,567 | 2008-09-15T12:57:00.000 | 0 | 0 | 1 | 0 | python,string,case-insensitive | 62,592 | 16 | false | 0 | 0 | I'm pretty sure you either have to use .lower() or use a regular expression. I'm not aware of a built-in case-insensitive string comparison function. | 4 | 52 | 0 | What is the easiest way to compare strings in Python, ignoring case?
Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads).
I guess I'm looking for an equivalent to C's stricmp().
[Some more context requested, so I'll demonstr... | Ignore case in Python strings | 0 | 0 | 0 | 109,190 |
62,567 | 2008-09-15T12:57:00.000 | -1 | 0 | 1 | 0 | python,string,case-insensitive | 62,652 | 16 | false | 0 | 0 | You could subclass str and create your own case-insenstive string class but IMHO that would be extremely unwise and create far more trouble than it's worth. | 4 | 52 | 0 | What is the easiest way to compare strings in Python, ignoring case?
Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads).
I guess I'm looking for an equivalent to C's stricmp().
[Some more context requested, so I'll demonstr... | Ignore case in Python strings | -0.012499 | 0 | 0 | 109,190 |
62,567 | 2008-09-15T12:57:00.000 | 0 | 0 | 1 | 0 | python,string,case-insensitive | 62,983 | 16 | false | 0 | 0 | For occasional or even repeated comparisons, a few extra string objects shouldn't matter as long as this won't happen in the innermost loop of your core code or you don't have enough data to actually notice the performance impact. See if you do: doing things in a "stupid" way is much less stupid if you also do it less.... | 4 | 52 | 0 | What is the easiest way to compare strings in Python, ignoring case?
Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads).
I guess I'm looking for an equivalent to C's stricmp().
[Some more context requested, so I'll demonstr... | Ignore case in Python strings | 0 | 0 | 0 | 109,190 |
62,567 | 2008-09-15T12:57:00.000 | 0 | 0 | 1 | 0 | python,string,case-insensitive | 65,834 | 16 | false | 0 | 0 | You could translate each string to lowercase once --- lazily only when you need it, or as a prepass to the sort if you know you'll be sorting the entire collection of strings. There are several ways to attach this comparison key to the actual data being sorted, but these techniques should be addressed in a separate is... | 4 | 52 | 0 | What is the easiest way to compare strings in Python, ignoring case?
Of course one can do (str1.lower() <= str2.lower()), etc., but this created two additional temporary strings (with the obvious alloc/g-c overheads).
I guess I'm looking for an equivalent to C's stricmp().
[Some more context requested, so I'll demonstr... | Ignore case in Python strings | 0 | 0 | 0 | 109,190 |
63,086 | 2008-09-15T13:55:00.000 | 1 | 0 | 1 | 0 | python | 1,538,995 | 22 | false | 0 | 0 | I'm surprised no one has mentioned IDLE as a good default python editor. Nice syntax colors, handles indents, has intellisense, easy to adjust fonts, and it comes with the default download of python. Heck, I write mostly IronPython, but it's so nice & easy to edit in IDLE and run ipy from a command prompt.
Oh, and wh... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.009091 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 0 | 0 | 1 | 0 | python | 64,186 | 22 | false | 0 | 0 | Many Python IDEs and generally-capable text/source editors can handle the whitespace for you.
However, it is best to just "let go" and enjoy the whitespace rules of Python. With some practice, they won't get into your way at all, and you will find they have many merits, the most important of which are:
Because of the ... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 0 | 0 | 1 | 0 | python | 64,899 | 22 | false | 0 | 0 | In Python, indentation is a semantic element as well as providing visual grouping for readability.
Both space and tab can indicate indentation. This is unfortunate, because:
The interpretation(s) of a tab varies
among editors and IDEs and is often
configurable (and often configured).
OTOH, some editors are not
configu... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 0 | 0 | 1 | 0 | python | 69,064 | 22 | false | 0 | 0 | Check the options of your editor or find an editor/IDE that allows you to convert TABs to spaces. I usually set the options of my editor to substitute the TAB character with 4 spaces, and I never run into any problems. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 1 | 0 | 1 | 0 | python | 63,450 | 22 | false | 0 | 0 | I was a bit reluctant to learn Python because of tabbing. However, I almost didn't notice it when I used Vim. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.009091 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 2 | 0 | 1 | 0 | python | 63,289 | 22 | false | 0 | 0 | Getting your indentation to work correctly is going to be important in any language you use.
Even though it won't affect the execution of the program in most other languages, incorrect indentation can be very confusing for anyone trying to read your program, so you need to invest the time in figuring out how to config... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.01818 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 0 | 0 | 1 | 0 | python | 1,515,244 | 22 | false | 0 | 0 | Yes, there is a way. I hate these "no way" answers, there is no way until you discover one.
And in that case, whatever it is worth, there is one.
I read once about a guy who designed a way to code so that a simple script could re-indent the code properly. I didn't managed to find any links today, though, but I swear I ... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 37 | 0 | 1 | 0 | python | 63,094 | 22 | false | 0 | 0 | No. Indentation-as-grammar is an integral part of the Python language, for better and worse. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 1 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 3 | 0 | 1 | 0 | python | 63,122 | 22 | false | 0 | 0 | You should disable tab characters in your editor when you're working with Python (always, actually, IMHO, but especially when you're working with Python). Look for an option like "Use spaces for tabs": any decent editor should have one. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.027266 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 10 | 0 | 1 | 0 | python | 68,061 | 22 | false | 0 | 0 | Emacs! Seriously, its use of "tab is a command, not a character", is absolutely perfect for python development. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 1 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 2 | 0 | 1 | 0 | python | 63,216 | 22 | false | 0 | 0 | I agree with justin and others -- pick a good editor and use spaces rather than tabs for indentation and the whitespace thing becomes a non-issue. I only recently started using Python, and while I thought the whitespace issue would be a real annoyance it turns out to not be the case. For the record I'm using emacs tho... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.01818 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 5 | 0 | 1 | 0 | python | 63,196 | 22 | false | 0 | 0 | It's possible to write a pre-processor which takes randomly-indented code with pseudo-python keywords like "endif" and "endwhile" and properly indents things. I had to do this when using python as an "ASP-like" language, because the whole notion of "indentation" gets a bit fuzzy in such an environment.
Of course, even ... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.045423 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 3 | 0 | 1 | 0 | python | 63,111 | 22 | false | 0 | 0 | No, there isn't. Indentation is syntax for Python. You can:
Use tabnanny.py to check your code
Use a syntax-aware editor that highlights such mistakes (vi does that, emacs I bet it does, and then, most IDEs do too)
(far-fetched) write a preprocessor of your own to convert braces (or whatever block delimiters you love)... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.027266 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 3 | 0 | 1 | 0 | python | 63,095 | 22 | false | 0 | 0 | I do not believe so, as Python is a whitespace-delimited language. Perhaps a text editor or IDE with auto-indentation would be of help. What are you currently using? | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.027266 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 5 | 0 | 1 | 0 | python | 63,819 | 22 | false | 0 | 0 | I find it hard to understand when people flag this as a problem with Python. I took to it immediately and actually find it's one of my favourite 'features' of the language :)
In other languages I have two jobs:
1. Fix the braces so the computer can parse my code
2. Fix the indentation so I can parse my code.
So in Pyth... | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 0.045423 | 0 | 0 | 15,517 |
63,086 | 2008-09-15T13:55:00.000 | 6 | 0 | 1 | 0 | python | 63,119 | 22 | false | 0 | 0 | All of the whitespace issues I had when I was starting Python were the result mixing tabs and spaces. Once I configured everything to just use one or the other, I stopped having problems.
In my case I configured UltraEdit & vim to use spaces in place of tabs. | 16 | 10 | 0 | I want to start using Python for small projects but the fact that a misplaced tab or indent can throw a compile error is really getting on my nerves. Is there some type of setting to turn this off?
I'm currently using NotePad++. Is there maybe an IDE that would take care of the tabs and indenting? | Is there a way around coding in Python without the tab, indent & whitespace criteria? | 1 | 0 | 0 | 15,517 |
63,681 | 2008-09-15T15:00:00.000 | 0 | 0 | 1 | 0 | python,delphi | 63,794 | 3 | false | 0 | 0 | If a process dies all it's threads die with it, so a solution might be a separate process.
See if creating a xmlrpc server might help you, that is a simple solution for interprocess communication. | 2 | 1 | 0 | I'm hosting Python script with Python for Delphi components inside my Delphi application. I'd like to create background tasks which keep running by script.
Is it possible to create threads which keep running even if the script execution ends (but not the host process, which keeps going on). I've noticed that the progr... | How create threads under Python for Delphi | 0 | 0 | 0 | 1,259 |
63,681 | 2008-09-15T15:00:00.000 | 0 | 0 | 1 | 0 | python,delphi | 63,767 | 3 | false | 0 | 0 | Threads by definition are part of the same process. If you want them to keep running, they need to be forked off into a new process; see os.fork() and friends.
You'll probably want the new process to end (via exit() or the like) immediately after spawning the script. | 2 | 1 | 0 | I'm hosting Python script with Python for Delphi components inside my Delphi application. I'd like to create background tasks which keep running by script.
Is it possible to create threads which keep running even if the script execution ends (but not the host process, which keeps going on). I've noticed that the progr... | How create threads under Python for Delphi | 0 | 0 | 0 | 1,259 |
64,141 | 2008-09-15T15:51:00.000 | 1 | 0 | 1 | 0 | python,class | 64,195 | 6 | false | 0 | 0 | Classes don't have values. Objects do. Is what you want basically a class that can reset an instance (object) to a set of default values?
How about just providing a reset method, that resets the properties of your object to whatever is the default?
I think you should simplify your question, or tell us what you really ... | 2 | 1 | 0 | In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second class with the same names for section... | Classes in Python | 0.033321 | 0 | 0 | 1,205 |
64,141 | 2008-09-15T15:51:00.000 | 1 | 0 | 1 | 0 | python,class | 64,206 | 6 | false | 0 | 0 | I think you are confused. You should re-check the meaning of "class" and "instance".
I think you are trying to first declare a Instance of a certain Class, and then declare a instance of other Class, use the data from the first one, and then find a way to convert the data in the second instance and use it on the first ... | 2 | 1 | 0 | In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class?
So I would make a class with the numbers 1 to 5 as the data in it, then make a second class with the same names for section... | Classes in Python | 0.033321 | 0 | 0 | 1,205 |
64,237 | 2008-09-15T16:03:00.000 | 6 | 0 | 0 | 0 | python,django | 68,086 | 8 | false | 1 | 0 | The rule I follow is it should be a new app if I want to reuse the functionality in a different project.
If it needs deep understanding of the models in your project, it's probably more cohesive to stick it with the models. | 5 | 130 | 0 | I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality to... | When to create a new app (with startapp) in Django? | 1 | 0 | 0 | 35,690 |
64,237 | 2008-09-15T16:03:00.000 | 14 | 0 | 0 | 0 | python,django | 64,308 | 8 | false | 1 | 0 | I tend to create new applications for each logically separate set of models. e.g.:
User Profiles
Forum Posts
Blog posts | 5 | 130 | 0 | I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality to... | When to create a new app (with startapp) in Django? | 1 | 0 | 0 | 35,690 |
64,237 | 2008-09-15T16:03:00.000 | 1 | 0 | 0 | 0 | python,django | 67,769 | 8 | false | 1 | 0 | An 'app' could be many different things, it all really comes down to taste. For example, let's say you are building a blog. Your app could be the entire blog, or you could have an 'admin' app, a 'site' app for all of the public views, an 'rss' app, a 'services' app so developers can interface with the blog in their own... | 5 | 130 | 0 | I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality to... | When to create a new app (with startapp) in Django? | 0.024995 | 0 | 0 | 35,690 |
64,237 | 2008-09-15T16:03:00.000 | 2 | 0 | 0 | 0 | python,django | 64,463,620 | 8 | false | 1 | 0 | The best answer to this question is given by Andrew Godwin (Django core developer):
The main purpose of apps is, in my eyes, to provide logical separation of reusable components - specifically, a first-class namespace for models/admin/etc. - and to provide an easy way to turn things “on” or “off”.
In some ways, it’s a ... | 5 | 130 | 0 | I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality to... | When to create a new app (with startapp) in Django? | 0.049958 | 0 | 0 | 35,690 |
64,237 | 2008-09-15T16:03:00.000 | 24 | 0 | 0 | 0 | python,django | 64,464 | 8 | false | 1 | 0 | I prefer to think of Django applications as reusable modules or components than as "applications".
This helps me encapsulate and decouple certain features from one another, improving re-usability should I decide to share a particular "app" with the community at large, and maintainability.
My general approach is to buc... | 5 | 130 | 0 | I've googled around for this, but I still have trouble relating to what Django defines as "apps".
Should I create a new app for each piece of functionality in a site, even though it uses models from the main project?
Do you guys have good rule of thumb of when to split off a new app, and when to keep functionality to... | When to create a new app (with startapp) in Django? | 1 | 0 | 0 | 35,690 |
64,426 | 2008-09-15T16:27:00.000 | 1 | 0 | 0 | 0 | python,client | 256,833 | 11 | false | 0 | 0 | There is no need to use HTTP (indeed, HTTP is not good for RPC in general in some respects), and no need to use a standards-based protocol if you're talking about a python client talking to a python server.
Use a Python-specific RPC library such as Pyro, or what Twisted provides (Twisted.spread). | 2 | 9 | 0 | I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a pretty old (and possibly unused these days?) protocol. | Best Python supported server/client protocol? | 0.01818 | 0 | 1 | 8,856 |
64,426 | 2008-09-15T16:27:00.000 | 4 | 0 | 0 | 0 | python,client | 256,826 | 11 | false | 0 | 0 | I suggest you look at 1. XMLRPC 2. JSONRPC 3. SOAP 4. REST/ATOM
XMLRPC is a valid choice. Don't worry it is too old. That is not a problem. It is so simple that little needed changing since original specification. The pro is that in every programming langauge I know there is a library for a client to be written in. Cer... | 2 | 9 | 0 | I'm looking for a good server/client protocol supported in Python for making data requests/file transfers between one server and many clients. Security is also an issue - so secure login would be a plus. I've been looking into XML-RPC, but it looks to be a pretty old (and possibly unused these days?) protocol. | Best Python supported server/client protocol? | 0.072599 | 0 | 1 | 8,856 |
65,076 | 2008-09-15T17:48:00.000 | 3 | 0 | 1 | 0 | python,vim,configuration,spaces | 66,818 | 7 | false | 0 | 0 | Ensure you are editing the correct configuration file for VIM. Especially if you are using windows, where the file could be named _vimrc instead of .vimrc as on other platforms.
In vim type
:help vimrc
and check your path to the _vimrc/.vimrc file with
:echo $HOME
:echo $VIM
Make sure you are only using one file. If yo... | 1 | 89 | 0 | I've trouble setting up Vim (7.1.xxx) for editing Python files (*.py).
Indenting seems to be broken (optimal 4 spaces).
I've followed some tutorials I found via Google. Still no effect :/
Please help. | How do I set up Vim autoindentation properly for editing Python files? | 0.085505 | 0 | 0 | 120,959 |
67,015 | 2008-09-15T21:11:00.000 | 2 | 1 | 0 | 0 | c++,boost-python | 93,027 | 3 | false | 0 | 0 | Found the solution! Boost builds a debug build by default. Typing "bjam release" builds the release configuration. (This isn't listed in any documentation anywhere, as far as I can tell.) Note that this is not the same as changing your build-type to release, as that doesn't build a release configuration. Doing a 'compl... | 2 | 3 | 0 | My development shop has put together a fairly useful Python-based test suite, and we'd like to test some Linux-based C++ code with it. We've gotten the test project they ship with Boost to compile (type 'bjam' in the directory and it works), but we're having issues with our actual project.
Building the boost libraries ... | Using boost-python with C++ in Linux | 0.132549 | 0 | 0 | 3,149 |
67,015 | 2008-09-15T21:11:00.000 | 2 | 1 | 0 | 0 | c++,boost-python | 67,282 | 3 | false | 0 | 0 | If you want to build the debug variants of the boost libraries as well, you have to invoke bjam with the option --build-type=complete.
On Debian, you get the debug Python interpreter in the python2.x-dbg packages. Debug builds of the Boost libraries are in libboost1.xy-dbg, if you want to use the system Boost. | 2 | 3 | 0 | My development shop has put together a fairly useful Python-based test suite, and we'd like to test some Linux-based C++ code with it. We've gotten the test project they ship with Boost to compile (type 'bjam' in the directory and it works), but we're having issues with our actual project.
Building the boost libraries ... | Using boost-python with C++ in Linux | 0.132549 | 0 | 0 | 3,149 |
67,454 | 2008-09-15T22:00:00.000 | -1 | 0 | 0 | 0 | python,django | 67,477 | 10 | false | 1 | 0 | Can't you just write a link to a "zip server" or whatnot? Why does the zip archive itself need to be served from Django? A 90's era CGI script to generate a zip and spit it to stdout is really all that's required here, at least as far as I can see. | 2 | 68 | 0 | How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my server down to a crawl. I have also heard that Django doesn't currentl... | Serving dynamically generated ZIP archives in Django | -0.019997 | 0 | 0 | 32,479 |
67,454 | 2008-09-15T22:00:00.000 | 1 | 0 | 0 | 0 | python,django | 73,617 | 10 | false | 1 | 0 | I suggest to use separate model for storing those temp zip files. You can create zip on-fly, save to model with filefield and finally send url to user.
Advantages:
Serving static zip files with django media mechanism (like usual uploads).
Ability to cleanup stale zip files by regular cron script execution (which can u... | 2 | 68 | 0 | How to serve users a dynamically generated ZIP archive in Django?
I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my server down to a crawl. I have also heard that Django doesn't currentl... | Serving dynamically generated ZIP archives in Django | 0.019997 | 0 | 0 | 32,479 |
68,243 | 2008-09-16T00:28:00.000 | 1 | 0 | 1 | 0 | python,compiler-construction,programming-languages,interpreter | 69,185 | 12 | false | 0 | 0 | Have you read Aho, Sethi, Ullman: "Compilers: Principles, Techniques, and Tools"? It is a classical language reference book.
/Allan | 5 | 14 | 0 | I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. | What's a good resource for starting to write a programming language, that's not context free? | 0.016665 | 0 | 0 | 2,008 |
68,243 | 2008-09-16T00:28:00.000 | 19 | 0 | 1 | 0 | python,compiler-construction,programming-languages,interpreter | 261,520 | 12 | false | 0 | 0 | A context-free grammar is, simply, one that doesn't require a symbol table in order to correctly parse the code. A context-sensitive grammar does.
The D programming language is an example of a context free grammar. C++ is a context sensitive one. (For example, is T*x declaring x to be pointer to T, or is it multiplying... | 5 | 14 | 0 | I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. | What's a good resource for starting to write a programming language, that's not context free? | 1 | 0 | 0 | 2,008 |
68,243 | 2008-09-16T00:28:00.000 | 1 | 0 | 1 | 0 | python,compiler-construction,programming-languages,interpreter | 68,575 | 12 | false | 0 | 0 | I would recommend that you write your parser by hand, in which case having significant whitespace should not present any real problems.
The main problem with using a parser generator is that it is difficult to get good error recovery in the parser. If you plan on implementing an IDE for your language, then having good ... | 5 | 14 | 0 | I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. | What's a good resource for starting to write a programming language, that's not context free? | 0.016665 | 0 | 0 | 2,008 |
68,243 | 2008-09-16T00:28:00.000 | 1 | 0 | 1 | 0 | python,compiler-construction,programming-languages,interpreter | 69,482 | 12 | false | 0 | 0 | If you've never written a parser before, start with something simple. Parsers are surprisingly subtle, and you can get into all sorts of trouble writing them if you've never studied the structure of programming languages.
Reading Aho, Sethi, and Ullman (it's known as "The Dragon Book") is a good plan. Contrary to other... | 5 | 14 | 0 | I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. | What's a good resource for starting to write a programming language, that's not context free? | 0.016665 | 0 | 0 | 2,008 |
68,243 | 2008-09-16T00:28:00.000 | 2 | 0 | 1 | 0 | python,compiler-construction,programming-languages,interpreter | 315,462 | 12 | false | 0 | 0 | If you're really going to take a whack at language design and implementation, you might want to add the following to your bookshelf:
Programming Language Pragmatics, Scott et al.
Design Concepts in Programming Languages, Turbak et al.
Modern Compiler Design, Grune et al. (I sacrilegiously prefer this to "The Dragon Bo... | 5 | 14 | 0 | I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free. | What's a good resource for starting to write a programming language, that's not context free? | 0.033321 | 0 | 0 | 2,008 |
68,541 | 2008-09-16T01:27:00.000 | 0 | 0 | 0 | 0 | python,macos,libxml2 | 70,895 | 3 | false | 0 | 0 | I would suspect the permissions on the library. Can you do a strace or similar to find out the filenames it's looking for, and then check the permissions on them? | 2 | 0 | 0 | When trying to use libxml2 as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.
I have installed python25 and all libxml2 and libxml2-py25 related libraries via fink and own the entire path including the library. Any ideas why I'd still need to sudo? | libxml2-p25 on OS X 10.5 needs sudo? | 0 | 0 | 1 | 225 |
68,541 | 2008-09-16T01:27:00.000 | 0 | 0 | 0 | 0 | python,macos,libxml2 | 77,114 | 3 | false | 0 | 0 | The PATH environment variable was the mistake. | 2 | 0 | 0 | When trying to use libxml2 as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.
I have installed python25 and all libxml2 and libxml2-py25 related libraries via fink and own the entire path including the library. Any ideas why I'd still need to sudo? | libxml2-p25 on OS X 10.5 needs sudo? | 0 | 0 | 1 | 225 |
68,630 | 2008-09-16T01:43:00.000 | 4 | 0 | 1 | 0 | python,performance,list,tuples,python-internals | 68,638 | 9 | false | 0 | 0 | Tuples should be slightly more efficient and because of that, faster, than lists because they are immutable. | 4 | 284 | 0 | Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? | Are tuples more efficient than lists in Python? | 0.088656 | 0 | 0 | 113,174 |
68,630 | 2008-09-16T01:43:00.000 | 9 | 0 | 1 | 0 | python,performance,list,tuples,python-internals | 71,295 | 9 | false | 0 | 0 | You should also consider the array module in the standard library if all the items in your list or tuple are of the same C type. It will take less memory and can be faster. | 4 | 284 | 0 | Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? | Are tuples more efficient than lists in Python? | 1 | 0 | 0 | 113,174 |
68,630 | 2008-09-16T01:43:00.000 | -6 | 0 | 1 | 0 | python,performance,list,tuples,python-internals | 53,385,158 | 9 | false | 0 | 0 | The main reason for Tuple to be very efficient in reading is because it's immutable.
Why immutable objects are easy to read?
The reason is tuples can be stored in the memory cache, unlike lists. The program always read from the lists memory location as it is mutable (can change any time). | 4 | 284 | 0 | Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? | Are tuples more efficient than lists in Python? | -1 | 0 | 0 | 113,174 |
68,630 | 2008-09-16T01:43:00.000 | 41 | 0 | 1 | 0 | python,performance,list,tuples,python-internals | 70,968 | 9 | false | 0 | 0 | Tuples, being immutable, are more memory efficient; lists, for speed efficiency, overallocate memory in order to allow appends without constant reallocs. So, if you want to iterate through a constant sequence of values in your code (eg for direction in 'up', 'right', 'down', 'left':), tuples are preferred, since such t... | 4 | 284 | 0 | Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? | Are tuples more efficient than lists in Python? | 1 | 0 | 0 | 113,174 |
68,645 | 2008-09-16T01:46:00.000 | 3 | 0 | 1 | 0 | python,class,oop,static,class-variables | 61,080,153 | 26 | false | 0 | 0 | So this is probably a hack, but I've been using eval(str) to obtain an static object, kind of a contradiction, in python 3.
There is an Records.py file that has nothing but class objects defined with static methods and constructors that save some arguments. Then from another .py file I import Records but i need to dyn... | 2 | 2,352 | 0 | How do I create static class variables or methods in Python? | Static class variables and methods in Python | 0.023073 | 0 | 0 | 1,501,442 |
68,645 | 2008-09-16T01:46:00.000 | 5 | 0 | 1 | 0 | python,class,oop,static,class-variables | 79,840 | 26 | false | 0 | 0 | To avoid any potential confusion, I would like to contrast static variables and immutable objects.
Some primitive object types like integers, floats, strings, and touples are immutable in Python. This means that the object that is referred to by a given name cannot change if it is of one of the aforementioned object ty... | 2 | 2,352 | 0 | How do I create static class variables or methods in Python? | Static class variables and methods in Python | 0.038443 | 0 | 0 | 1,501,442 |
69,979 | 2008-09-16T07:07:00.000 | 0 | 1 | 0 | 0 | python,authentication,cgi | 70,003 | 6 | false | 0 | 0 | With a bit of JavaScript, you could have the client hash the entered password and a server-generated nonce, and use that in an HTTP GET. | 3 | 1 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | Can I implement a web user authentication system in python without POST? | 0 | 0 | 1 | 2,893 |
69,979 | 2008-09-16T07:07:00.000 | 5 | 1 | 0 | 0 | python,authentication,cgi | 69,995 | 6 | true | 0 | 0 | You can actually do it all with GET methods. However, you'll want to use a full challenge response protocol for the logins. (You can hash on the client side using javascript. You just need to send out a unique challenge each time.) You'll also want to use SSL to ensure that no one can see the strings as they go acr... | 3 | 1 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | Can I implement a web user authentication system in python without POST? | 1.2 | 0 | 1 | 2,893 |
69,979 | 2008-09-16T07:07:00.000 | 1 | 1 | 0 | 0 | python,authentication,cgi | 69,989 | 6 | false | 0 | 0 | You could use HTTP Authentication, if supported.
You'd have to add SSL, as all methods, POST, GET and HTTP Auth (well, except Digest HHTP authentication) send plaintext.
GET is basically just like POST, it just has a limit on the amount of data you can send which is usually a lot smaller than POST and a semantic differ... | 3 | 1 | 0 | My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?
If it's not, how would you do it with POST? Just out of curiosity.
Cheers! | Can I implement a web user authentication system in python without POST? | 0.033321 | 0 | 1 | 2,893 |
70,797 | 2008-09-16T09:44:00.000 | 19 | 0 | 1 | 1 | python,input,command-line-arguments | 70,869 | 12 | false | 0 | 0 | Careful not to use the input function, unless you know what you're doing. Unlike raw_input, input will accept any python expression, so it's kinda like eval | 1 | 591 | 0 | How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line? | How to prompt for user input and read command-line arguments | 1 | 0 | 0 | 1,321,249 |
71,468 | 2008-09-16T11:44:00.000 | 1 | 0 | 0 | 1 | java,python,command-line,ocsp | 108,678 | 5 | false | 0 | 0 | bouncycastle has a Java crypto-provider and support for OCSP requests and responses. The differences between OCSPReq and OCSPRequest and OCSPResp and OCSPResponse class are a little confusing, though. | 1 | 3 | 0 | Does anybody know of a tool to test OCSP responses? Preferably, something that can be used from a Windows Command-line and/or can be included (easily) in a Java/python program | OCSP command-line test tool? | 0.039979 | 0 | 0 | 8,106 |
71,817 | 2008-09-16T12:46:00.000 | 1 | 0 | 0 | 0 | python,metaclass | 73,473 | 5 | false | 1 | 0 | Look at the functools.wraps() decorator; it does all of this, but I don't know offhand if you can get it to run in the right context | 2 | 4 | 0 | The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute.
Advanced users can create their own subclasses to exten... | Using the docstring from one method to automatically overwrite that of another method | 0.039979 | 0 | 0 | 2,897 |
71,817 | 2008-09-16T12:46:00.000 | 0 | 0 | 0 | 0 | python,metaclass | 72,126 | 5 | false | 1 | 0 | Well the doc-string is stored in __doc__ so it wouldn't be too hard to re-assign it based on the doc-string of _execute after the fact.
Basically:
class MyClass(object):
def execute(self):
'''original doc-string'''
self._execute()
class SubClass(MyClass):
def _execute(self):
'''sub-cl... | 2 | 4 | 0 | The problem: I have a class which contains a template method execute which calls another method _execute. Subclasses are supposed to overwrite _execute to implement some specific functionality. This functionality should be documented in the docstring of _execute.
Advanced users can create their own subclasses to exten... | Using the docstring from one method to automatically overwrite that of another method | 0 | 0 | 0 | 2,897 |
73,663 | 2008-09-16T15:35:00.000 | 0 | 1 | 0 | 1 | python,termination | 70,824,754 | 12 | false | 0 | 0 | Just put at the end of your code quit() and that should close a python script. | 2 | 1,288 | 0 | I am aware of the die() command in PHP which exits a script early.
How can I do this in Python? | How to terminate a script? | 0 | 0 | 0 | 1,876,007 |
73,663 | 2008-09-16T15:35:00.000 | 75 | 1 | 0 | 1 | python,termination | 76,374 | 12 | false | 0 | 0 | While you should generally prefer sys.exit because it is more "friendly" to other code, all it actually does is raise an exception.
If you are sure that you need to exit a process immediately, and you might be inside of some exception handler which would catch SystemExit, there is another function - os._exit - which te... | 2 | 1,288 | 0 | I am aware of the die() command in PHP which exits a script early.
How can I do this in Python? | How to terminate a script? | 1 | 0 | 0 | 1,876,007 |
74,386 | 2008-09-16T16:44:00.000 | 3 | 1 | 0 | 0 | .net,delphi,ironpython,unmanaged,ironruby | 934,717 | 6 | false | 0 | 1 | Why not embed CPython instead, which has an API intended to be used directly from C/C++. You lose the multiple language advantage but probably gain simplicity. | 1 | 5 | 0 | Is it possible to call managed code, specifically IronRuby or IronPython from unamanaged code such as C++ or Delphi?
For example, we have an application written in Delphi that is being moved to C#.NET We'd like to provide Ruby or Python scripting in our new application to replace VBSCRIPT. However, we would need to p... | Using DLR from Unmanaged Code | 0.099668 | 0 | 0 | 877 |
74,430 | 2008-09-16T16:49:00.000 | 1 | 0 | 1 | 0 | python | 76,404 | 8 | false | 0 | 0 | If the script you are trying to run is itself called random.py, then you would have a naming conflict. Choose a different name for your script. | 2 | 9 | 0 | I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use.
Am I missing something? | Random in python 2.5 not working? | 0.024995 | 0 | 0 | 5,445 |
74,430 | 2008-09-16T16:49:00.000 | 3 | 0 | 1 | 0 | python | 78,304 | 8 | false | 0 | 0 | This is happening because you have a random.py file in the python search path, most likely the current directory.
Python is searching for modules using sys.path, which normally includes the current directory before the standard site-packages, which contains the expected random.py.
This is expected to be fixed in Python... | 2 | 9 | 0 | I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use.
Am I missing something? | Random in python 2.5 not working? | 0.07486 | 0 | 0 | 5,445 |
75,440 | 2008-09-16T18:26:00.000 | 43 | 0 | 1 | 0 | python | 75,456 | 5 | false | 0 | 0 | It's not a method, it's a field. The field is called __name__. class.__name__ will give the name of the class as a string. object.__class__.__name__ will give the name of the class of an object. | 2 | 50 | 0 | What method do I call to get the name of a class? | How do I get the string with name of a class? | 1 | 0 | 0 | 45,412 |
75,440 | 2008-09-16T18:26:00.000 | 1 | 0 | 1 | 0 | python | 77,222 | 5 | false | 0 | 0 | In [8]: str('2'.__class__)
Out[8]: "<type 'str'>"
In [9]: str(len.__class__)
Out[9]: "<type 'builtin_function_or_method'>"
In [10]: str(4.6.__class__)
Out[10]: "<type 'float'>"
Or, as was pointed out before,
In [11]: 4.6.__class__.__name__
Out[11]: 'float' | 2 | 50 | 0 | What method do I call to get the name of a class? | How do I get the string with name of a class? | 0.039979 | 0 | 0 | 45,412 |
75,798 | 2008-09-16T19:05:00.000 | 10 | 0 | 0 | 0 | python,django,frameworks | 1,997,668 | 9 | false | 1 | 0 | The statement that grails deletes the database on start-up is completely wrong. It's behavior on start-up is completely configurable and easy to configure. I generally use create-drop when running an app in dev mode. I use update when I run in test and production.
I also love the bootstrap processing that lets me pr... | 5 | 23 | 0 | I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However ... | Django -vs- Grails -vs-? | 1 | 0 | 0 | 19,797 |
75,798 | 2008-09-16T19:05:00.000 | 10 | 0 | 0 | 0 | python,django,frameworks | 460,360 | 9 | false | 1 | 0 | Grails.
Grails just looks like Rails (Ruby),but it uses groovy which is simpler than java. It uses java technology and you can use any java lib without any trouble.
I also choose Grails over simplicity and there are lots of java lib (such as jasper report, jawr etc) and I am glad that now they join with SpringSource w... | 5 | 23 | 0 | I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However ... | Django -vs- Grails -vs-? | 1 | 0 | 0 | 19,797 |
75,798 | 2008-09-16T19:05:00.000 | 1 | 0 | 0 | 0 | python,django,frameworks | 81,699 | 9 | false | 1 | 0 | Personally I made some rather big projects with Django, but I can compare only with said "montrosities" (Spring, EJB) and really low-level stuff like Twisted.
Web frameworks using interpreted languages are mostly in its infancy and all of them (actively maintained, that is) are getting better with every day. | 5 | 23 | 0 | I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However ... | Django -vs- Grails -vs-? | 0.022219 | 0 | 0 | 19,797 |
75,798 | 2008-09-16T19:05:00.000 | 1 | 0 | 0 | 0 | python,django,frameworks | 76,198 | 9 | false | 1 | 0 | cakephp.org
Cakephp is really good, really close to ruby on rails (1.2). It is in php, works very well on shared hosts and is easy to implement.
The only downside is that the documentation is somewhat lacking, but you quickly get it and quickly start doing cool stuff.
I totally recommend cakephp. | 5 | 23 | 0 | I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However ... | Django -vs- Grails -vs-? | 0.022219 | 0 | 0 | 19,797 |
75,798 | 2008-09-16T19:05:00.000 | 32 | 0 | 0 | 0 | python,django,frameworks | 1,955,727 | 9 | true | 1 | 0 | You asked for someone who used both Grails and Django. I've done work on both for big projects. Here's my Thoughts:
IDE's:
Django works really well in Eclipse, Grails works really well in IntelliJ Idea.
Debugging:
Practically the same (assuming you use IntelliJ for Grails, and Eclipse for Python). Step debugging, inspe... | 5 | 23 | 0 | I'm wondering if there's such a thing as Django-like ease of web app development combined with good deployment, debugging and other tools?
Django is a very productive framework for building content-heavy sites; the best I've tried and a breath of fresh air compared to some of the Java monstrosities out there. However ... | Django -vs- Grails -vs-? | 1.2 | 0 | 0 | 19,797 |
75,829 | 2008-09-16T19:08:00.000 | 4 | 0 | 0 | 0 | python,sql,sqlalchemy | 77,962 | 3 | false | 0 | 0 | via the __table__ attribute on your declarative class | 2 | 8 | 0 | All the docs for SQLAlchemy give INSERT and UPDATE examples using the local table instance (e.g. tablename.update()... )
Doing this seems difficult with the declarative syntax, I need to reference Base.metadata.tables["tablename"] to get the table reference.
Am I supposed to do this another way? Is there a different ... | Best way to access table instances when using SQLAlchemy's declarative syntax | 0.26052 | 1 | 0 | 2,919 |
75,829 | 2008-09-16T19:08:00.000 | 0 | 0 | 0 | 0 | python,sql,sqlalchemy | 315,406 | 3 | false | 0 | 0 | There may be some confusion between table (the object) and tablename (the name of the table, a string). Using the table class attribute works fine for me. | 2 | 8 | 0 | All the docs for SQLAlchemy give INSERT and UPDATE examples using the local table instance (e.g. tablename.update()... )
Doing this seems difficult with the declarative syntax, I need to reference Base.metadata.tables["tablename"] to get the table reference.
Am I supposed to do this another way? Is there a different ... | Best way to access table instances when using SQLAlchemy's declarative syntax | 0 | 1 | 0 | 2,919 |
76,408 | 2008-09-16T20:11:00.000 | 3 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 76,441 | 12 | false | 0 | 0 | That depends on the implementation, if it will be distributed I would go with Java, seeing as you know that, because of its portability. If it is just for internal use, or will be used in semi-controlled environments, then go with whatever you are the most comfortable maintaining, and whichever has the best long-term ... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0.049958 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 0 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 76,470 | 12 | false | 0 | 0 | Well, what kind of exploits are you thinking about? If you want to write something that needs low level stuff (ptrace, raw sockets, etc.) then you'll need to learn C. But both Perl and Python can be used. The real question is which one suits your style more?
As for toolmaking, Perl has good string-processing abilities,... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 1 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 76,495 | 12 | false | 0 | 0 | All of them should be sufficient for that. Unless you need some library that is only available in one language, I'd let personal preference guide me. | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0.016665 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 1 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 76,508 | 12 | false | 0 | 0 | If you're looking for a scripting language that will play well with Java, you might want to look at Groovy. It has the flexibility and power of Perl (closures, built in regexes, associative arrays on every corner) but you can access Java code from it thus you have access to a huge number of libraries, and in particula... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0.016665 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 3 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 78,106 | 12 | false | 0 | 0 | If you plan on using Metasploit for pen-testing and exploit development I would recommend ruby as mentioned previously Metasploit is written in ruby and any exploit/module development you may wish to do will require ruby.
If you will be using Immunity CANVAS for pen testing then for the same reasons I would recommend P... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0.049958 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 0 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 4,927,367 | 12 | false | 0 | 0 | I'm with tqbf. I've worked with Python and Ruby. Currently I'm working with JRuby. It has all the power of Ruby with access to the Java libraries so if there is something you absolutely need a low-level language to solve you can do so with a high-level language. So far I haven't needed to really use much Java as Ru... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 0 | 0 | 0 | 6,338 |
76,408 | 2008-09-16T20:11:00.000 | 8 | 1 | 0 | 0 | python,ruby,perl,security,penetration-testing | 77,717 | 12 | false | 0 | 0 | [Disclaimer: I am primarily a Perl programmer, which may be colouring my judgement. However, I am not a particularly tribal one, and I think on this particular question my argument is reasonably objective.]
Perl was designed to blend seamlessly into the Unix landscape, and that is why it feels so alien to people with a... | 7 | 6 | 0 | First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Which of these scripting languages is more appropriate for pen-testing? | 1 | 0 | 0 | 6,338 |
76,882 | 2008-09-16T20:48:00.000 | 2 | 0 | 1 | 0 | python,vba,porting | 189,311 | 8 | false | 0 | 0 | While I'm not a Python programmer, you might be able to run VSTO with Iron Python and Visual Studio. At least that way, you won't have to learn VBA syntax. | 3 | 21 | 0 | I have written a lot of code in Python, and I am very used to the syntax, object structure, and so forth of Python because of it.
What is the best online guide or resource site to provide me with the basics, as well as a comparison or lookup guide with equivalent functions/features in VBA versus Python.
For example, I ... | Resources for Python Programmer | 0.049958 | 0 | 0 | 9,282 |
76,882 | 2008-09-16T20:48:00.000 | 2 | 0 | 1 | 0 | python,vba,porting | 76,989 | 8 | false | 0 | 0 | VBA as in what was implemented as part of Office 2000, 2003 and VB6 have been deprecated in favor of .Net technologies. Unless you are maintaining old code stick to python or maybe even go with IronPython for .Net. If you go IronPython, you may have to write some C#/VB.Net helper classes here and there when working w... | 3 | 21 | 0 | I have written a lot of code in Python, and I am very used to the syntax, object structure, and so forth of Python because of it.
What is the best online guide or resource site to provide me with the basics, as well as a comparison or lookup guide with equivalent functions/features in VBA versus Python.
For example, I ... | Resources for Python Programmer | 0.049958 | 0 | 0 | 9,282 |
76,882 | 2008-09-16T20:48:00.000 | 25 | 0 | 1 | 0 | python,vba,porting | 186,583 | 8 | false | 0 | 0 | VBA is quite different from Python, so you should read at least the "Microsoft Visual Basic Help" as provided by the application you are going to use (Excel, Access…).
Generally speaking, VBA has the equivalent of Python modules; they're called "Libraries", and they are not as easy to create as Python modules. I mentio... | 3 | 21 | 0 | I have written a lot of code in Python, and I am very used to the syntax, object structure, and so forth of Python because of it.
What is the best online guide or resource site to provide me with the basics, as well as a comparison or lookup guide with equivalent functions/features in VBA versus Python.
For example, I ... | Resources for Python Programmer | 1 | 0 | 0 | 9,282 |
77,086 | 2008-09-16T21:05:00.000 | 7 | 1 | 0 | 0 | php,python,performance,pylons | 33,627,050 | 10 | false | 0 | 0 | I would assume that PHP (>5.5) is faster and more reliable for complex web applications because it is optimized for website scripting.
Many of the benchmarks you will find at the net are only made to prove that the favoured language is better. But you can not compare 2 languages with a mathematical task running X-times... | 9 | 41 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still ... | Which is faster, python webpages or php webpages? | 1 | 0 | 0 | 58,657 |
77,086 | 2008-09-16T21:05:00.000 | 1 | 1 | 0 | 0 | php,python,performance,pylons | 77,093 | 10 | false | 0 | 0 | If it ain't broke don't fix it.
Just write a quick test, but bear in mind that each language will be faster with certain functions then the other. | 9 | 41 | 0 | Which is faster, python webpages or php webpages?
Does anyone know how the speed of pylons(or any of the other frameworks) compares to a similar website made with php?
I know that serving a python base webpage via cgi is slower than php because of its long start up every time.
I enjoy using pylons and I would still ... | Which is faster, python webpages or php webpages? | 0.019997 | 0 | 0 | 58,657 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.