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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
802,578 | 2009-04-29T14:21:00.000 | 6 | 0 | 1 | 0 | java,python,keyword,final | 802,617 | 11 | false | 0 | 0 | Python has no equivalent of "final". It doesn't have "public" and "protected" either, except by naming convention. It's not that "bondage and discipline". | 2 | 78 | 0 | I couldn't find documentation on an equivalent of Java's final in Python, is there such a thing?
I'm creating a snapshot of an object (used for restoration if anything fails); once this backup variable is assigned, it should not be modified -- a final-like feature in Python would be nice for this. | `final` keyword equivalent for variables in Python? | 1 | 0 | 0 | 83,113 |
803,566 | 2009-04-29T18:09:00.000 | 2 | 0 | 1 | 0 | python,multithreading,deadlock,embedding | 803,703 | 3 | false | 0 | 0 | "When calling into Python, I may need to hold the same locks, because I may be iterating over some collection of objects, for example."
This often indicates that a single process with multiple threads isn't appropriate. Perhaps this is a situation where multiple processes -- each with a specific object from the collec... | 2 | 7 | 0 | Is there any way to embed python, allow callbacks from python to C++, allowing the Pythhon code to spawn threads, and avoiding deadlocks?
The problem is this:
To call into Python, I need to hold the GIL. Typically, I do this by getting the main thread state when I first create the interpreter, and then using PyEval_Re... | Python embedding with threads -- avoiding deadlocks? | 0.132549 | 0 | 0 | 1,957 |
803,566 | 2009-04-29T18:09:00.000 | 2 | 0 | 1 | 0 | python,multithreading,deadlock,embedding | 804,431 | 3 | false | 0 | 0 | The code that is called by python should release the GIL before taking any of your locks.
That way I believe it can't get into the dead-lock. | 2 | 7 | 0 | Is there any way to embed python, allow callbacks from python to C++, allowing the Pythhon code to spawn threads, and avoiding deadlocks?
The problem is this:
To call into Python, I need to hold the GIL. Typically, I do this by getting the main thread state when I first create the interpreter, and then using PyEval_Re... | Python embedding with threads -- avoiding deadlocks? | 0.132549 | 0 | 0 | 1,957 |
805,120 | 2009-04-30T02:19:00.000 | 1 | 0 | 0 | 1 | python | 1,556,571 | 5 | false | 1 | 0 | You can have a look at celery | 2 | 4 | 0 | My question is: which python framework should I use to build my server?
Notes:
This server talks HTTP with it's clients: GET and POST (via pyAMF)
Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result"
submit and retrieve might be separated by days - different HTTP co... | Python "Task Server" | 0.039979 | 0 | 0 | 2,958 |
805,120 | 2009-04-30T02:19:00.000 | 0 | 0 | 0 | 1 | python | 805,126 | 5 | false | 1 | 0 | It seems any python web framework will suit your needs. I work with a similar system on a daily basis and I can tell you, your solution with threads and SQLite for queue storage is about as simple as you're going to get.
Assuming order doesn't matter in your queue, then threads should be acceptable. It's important to ... | 2 | 4 | 0 | My question is: which python framework should I use to build my server?
Notes:
This server talks HTTP with it's clients: GET and POST (via pyAMF)
Clients "submit" "tasks" for processing and, then, sometime later, retrieve the associated "task_result"
submit and retrieve might be separated by days - different HTTP co... | Python "Task Server" | 0 | 0 | 0 | 2,958 |
805,160 | 2009-04-30T02:39:00.000 | 2 | 1 | 1 | 0 | python,perl | 805,185 | 3 | false | 0 | 0 | You could serialize the results to some sort of a string format, print this to standard output in the Perl script. Then, from python call the perl script and redirect the results of stdout to a variable in python. | 1 | 1 | 0 | I have one script in Perl and the other in Python. I need to get the results of Perl in Python and then give the final report. The results from Perl can be scalar variable, hash variable, or an array.
Please let me know as soon as possible regarding this. | How can I get the results of a Perl script in Python script? | 0.132549 | 0 | 0 | 1,453 |
805,393 | 2009-04-30T05:03:00.000 | 0 | 0 | 0 | 0 | python,sql,django,stored-procedures,django-models | 3,675,814 | 7 | false | 1 | 0 | I guess the improved raw sql queryset support in Django 1.2 can make this easier as you wouldn't have to roll your own make_instance type code. | 2 | 34 | 0 | I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? | What is the best way to access stored procedures in Django's ORM | 0 | 0 | 0 | 43,756 |
805,393 | 2009-04-30T05:03:00.000 | 6 | 0 | 0 | 0 | python,sql,django,stored-procedures,django-models | 806,302 | 7 | false | 1 | 0 | Don't.
Seriously.
Move the stored procedure logic into your model where it belongs.
Putting some code in Django and some code in the database is a maintenance nightmare. I've spent too many of my 30+ years in IT trying to clean up this kind of mess. | 2 | 34 | 0 | I am designing a fairly complex database, and know that some of my queries will be far outside the scope of Django's ORM. Has anyone integrated SP's with Django's ORM successfully? If so, what RDBMS and how did you do it? | What is the best way to access stored procedures in Django's ORM | 1 | 0 | 0 | 43,756 |
805,720 | 2009-04-30T07:08:00.000 | 0 | 0 | 1 | 0 | python,theory | 805,801 | 11 | false | 0 | 0 | enhance my knowledge of computers
Well, what do you exactly mean by that? Python, or any other high level language, are designed to actually hide all the nasty details. That's one of the reasons, why it's apt for non-pros like (e.g. scientist).
If you want to know how stuff actually work, you should learn pure C. But... | 1 | 10 | 0 | I'm a newbie to programming. I had 1 semester of computer science (we used java). I got an A in the course and was able to do everything assigned, however I'm not sure I really understood it. I ignored the text and learned by looking at sample programs and then trial and error. I was ahead of the class except for two ... | Newbie teaching self python, what else should I be learning? | 0 | 0 | 0 | 3,403 |
805,957 | 2009-04-30T08:43:00.000 | 12 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,037 | 16 | false | 0 | 0 | Using C++ is likely to result in a radically faster application than PHP, Perl or Python and somewhat faster than C# or Java - unless it spends most of its time waiting for the DB, in which case there won't be a difference. This is actually the most common case.
On the other hand, due to the reasons benhoyt mentioned, ... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 1 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 23 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,004 | 16 | true | 0 | 0 | Several years ago, I more or less learned web app programming on the job. C was the main language I knew, so I wrote the (fairly large-scale) web app in C. Bad mistake. C's string handling and memory management is tedious, and together with my lack of experience in web apps, it quickly became a hard-to-maintain project... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 1.2 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 6 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,257 | 16 | false | 0 | 0 | If you want to be able to implement web services in an existing running process (e.g. daemon), which is written in C/C++. It makes sense to make that process implement the FastCGI protocol for that interface. Get Apache to deal with HTTP (2-way SSL etc) to the outside world and field requests through FastCGI through a ... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 1 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 2 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,042 | 16 | false | 0 | 0 | You can use FastCGI with PHP/Python/Ruby/Perl to get runtime performance that should be enough until your site grows really big. And even then, you can make architectural improvements (database tuning, caching etc) to scale even more without abandoning scripting languages. Some pretty large sites are done in PHP/Python... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0.024995 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 3 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,988 | 16 | false | 0 | 0 | There is a middle ground here. Python (and I believe Perl and Ruby) allow you to call functions from C. 99 times out of 100, you won't need to. But it's nice to know that the option is there if you need it.
Usually for webapps, the speed of the programming language simply isn't an issue. In the time it takes to exe... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0.037482 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 7 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 806,293 | 16 | false | 0 | 0 | The question is "where's the value created?"
If you think the value is created in Memory management, careful class design and getting the nightly build to work, then use C++. You'll get to spend lots of time writing a lot of code to do important things like deleting objects that are no longer referenced.
If you think ... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 1 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 2 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 1,470,204 | 16 | false | 0 | 0 | Well... You will save memory and CPU power with C/C++ vs Python/Perl/Ruby/Java/.NET. If the resources saved by using C/C++ represents a large fraction of the total resources available (a FastCGI running on the embedded board of a robot), then yeah, C/C++. Else, why bother ? | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0.024995 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 1 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 9,231,448 | 16 | false | 0 | 0 | C++ is a strongly typed language...i.e. you can declare ints, floats, etc....generally you can program more efficiently than you can with weakly typed languages. Facebook reported a 50% improvement when switching from PHP to C++. I would consider scripting languages to be prototyping languages...when you want product... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0.012499 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 0 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 9,242,626 | 16 | false | 0 | 0 | My every search through Google indicates C/C++ gives best performance for web apps that need functionality such as searching for information in web pages or getting information from a database. | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0 | 0 | 0 | 16,655 |
805,957 | 2009-04-30T08:43:00.000 | 1 | 1 | 0 | 0 | php,c++,python,perl,fastcgi | 1,321,663 | 16 | false | 0 | 0 | Too bad there are no benchmarks of C/C++ vs Perl CGI.
Without FastCGI I think C/C++ would be a lot faster, with FastCGI possibly it'll be faster (but maybe a little less - all the initialization part is executed once).
Again this is very application dependent, so some sort of benchmarks for different dynamic web pages ... | 10 | 24 | 0 | What are the ups and downs of using FastCGI C++ vs. PHP/Python/Perl to do the same job.
Any performance or design pitfalls or using one over the other? Even your opinions are welcome. (Tell me why one or the other rocks, or one or the other sucks). | FastCGI C++ vs. A Script Language (PHP/Python/Perl) | 0.012499 | 0 | 0 | 16,655 |
809,564 | 2009-04-30T23:25:00.000 | 5 | 1 | 1 | 0 | python,unit-testing | 814,552 | 5 | true | 0 | 0 | You can't frequently run all your tests, because they're too slow. This is an inevitable consequence of your project getting bigger, and won't go away. Sure, you may be able to run the tests in parallel and get a nice speedup, but the problem will just come back later, and it'll never be as it was when your project was... | 4 | 4 | 0 | I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster? | distributed/faster python unit tests | 1.2 | 0 | 0 | 1,201 |
809,564 | 2009-04-30T23:25:00.000 | 3 | 1 | 1 | 0 | python,unit-testing | 811,222 | 5 | false | 0 | 0 | See py.test, which has the ability to pass unit tests off to a group of machines, or Nose, which (as of trunk, not the currently released version) supports running tests in parallel with the multiprocessing module. | 4 | 4 | 0 | I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster? | distributed/faster python unit tests | 0.119427 | 0 | 0 | 1,201 |
809,564 | 2009-04-30T23:25:00.000 | 1 | 1 | 1 | 0 | python,unit-testing | 810,002 | 5 | false | 0 | 0 | While coding, only run the tests of the class that You have just changed, not all the tests in the whole project.
Still, it is a good practice to run all tests before You commit Your code (but the Continuous Integration server can do it for You). | 4 | 4 | 0 | I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster? | distributed/faster python unit tests | 0.039979 | 0 | 0 | 1,201 |
809,564 | 2009-04-30T23:25:00.000 | 2 | 1 | 1 | 0 | python,unit-testing | 809,629 | 5 | false | 0 | 0 | Profile them to see what really is slow. You may be able to solve this problem with out distribution. If the tests are truly unit tests then I see not many problems with running the tests across multiple execution engines. | 4 | 4 | 0 | I have a lot of python unit tests for a project and it's getting to the point where it takes a long time to run them. I don't want to add more because I know they're going to make things slower. How do people solve this problem? Is there any easy way to distribute the test execution over a cluster? | distributed/faster python unit tests | 0.07983 | 0 | 0 | 1,201 |
809,737 | 2009-05-01T00:32:00.000 | 0 | 1 | 1 | 0 | .net,tdd,ironpython | 809,754 | 4 | false | 0 | 0 | What I've found however, is that IronPython to the best of my knowledge appears to be based on Python v2, while many of the learning resources available on the web are focused on Python v3.
I don't know what resources you've been looking at, but the majority of them are for v2. | 1 | 1 | 0 | I'm interested in learning python to have access to a more agile language for writing tests in my .NET projects.
Is IronPython mature enough for these purposes yet? I'm content with writing tests in C#, but find dynamic languages like ruby and python very attractive. Would it be better to forgo IronPython while learni... | Learning Python on Windows for TDD | 0 | 0 | 0 | 314 |
809,837 | 2009-05-01T01:11:00.000 | 1 | 0 | 0 | 0 | python,regex,mediawiki | 809,900 | 4 | false | 1 | 0 | RegExp: \w+( \w+)+(?=]])
input
[[Alexander of Paris|poet named Alexander]]
output
poet named Alexander
input
[[Alexander of Paris]]
output
Alexander of Paris | 1 | 3 | 0 | If I have some xml containing things like the following mediawiki markup:
" ...collected in the 12th century, of which [[Alexander the Great]] was the
hero, and in which he was represented,
somewhat like the British [[King
Arthur|Arthur]]"
what would be the appropriate arguments to something like:
re.findall... | Python regex for finding contents of MediaWiki markup links | 0.049958 | 0 | 1 | 1,132 |
809,859 | 2009-05-01T01:21:00.000 | -3 | 0 | 1 | 0 | python,readability | 5,759,751 | 13 | false | 0 | 0 | I suppose 4 tab space makes the code far more readable... atleast as far as i have worked on my projects tab space of 4 has been the most comfortable option.... | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | -0.046121 | 0 | 0 | 31,043 |
809,859 | 2009-05-01T01:21:00.000 | 1 | 0 | 1 | 0 | python,readability | 814,408 | 13 | false | 0 | 0 | The argument for tab over spaces is that it allows each person to customize their editor to see whatever level of indentation they want. The argument against tabs is that it's difficult to spot (for the writer) when they've mixed tabs and spaces. Occasionally you will want lines that aren't indented to a tab stop, whic... | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | 0.015383 | 0 | 0 | 31,043 |
809,859 | 2009-05-01T01:21:00.000 | 4 | 0 | 1 | 0 | python,readability | 810,067 | 13 | false | 0 | 0 | In the past I used 3 spaces. And that's still my preference. But 4 spaces seems to be the standard in the VB world. So I have switched to 4 to be in line with most code examples I see, and with the rest of my team. | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | 0.061461 | 0 | 0 | 31,043 |
809,859 | 2009-05-01T01:21:00.000 | 0 | 0 | 1 | 0 | python,readability | 809,944 | 13 | false | 0 | 0 | I read that 2 spaces is actually optimal, based on a study where programmers were asked to estimate the level of nesting based on indentation, but that when asked, programmers thought 4 would be optimal. Citation needed, but can't find it. | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | 0 | 0 | 0 | 31,043 |
809,859 | 2009-05-01T01:21:00.000 | -1 | 0 | 1 | 0 | python,readability | 809,875 | 13 | false | 0 | 0 | I've always used one tab as two spaces. | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | -0.015383 | 0 | 0 | 31,043 |
809,859 | 2009-05-01T01:21:00.000 | 3 | 0 | 1 | 0 | python,readability | 809,865 | 13 | false | 0 | 0 | I don't know of any studies that would answer your question. I don't think there is a way for this to be non-subjective but my personal preference is 4 spaces. | 6 | 23 | 0 | Personal preferences aside, is there an optimal tab size (2 spaces? 3 spaces? 8 spaces?) for code readability? In the different projects I've worked on, people seem to have vastly different standards. I can't seem to read 2 space indents, but companies like Google use it as a standard.
Can anyone point to documentation... | Optimal tab size for code readability | 0.046121 | 0 | 0 | 31,043 |
810,055 | 2009-05-01T03:24:00.000 | 3 | 1 | 1 | 0 | python | 40,535,335 | 4 | false | 0 | 0 | Python is very powerful language, Many big and the very high ranked websites are built on python..
Some big products of python are:-
Google (extensively used)
Youtube (extensively used)
Disqus
Eventbrite
Pinterest
Reddit
Quora
Mozilla
Asana (extensively used)
Dropbox (started with python, stayed with python)
Even... | 3 | 21 | 0 | What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams.
It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller.
Are there some huge companies that devel... | Biggest python projects | 0.148885 | 0 | 0 | 22,280 |
810,055 | 2009-05-01T03:24:00.000 | 12 | 1 | 1 | 0 | python | 810,240 | 4 | false | 0 | 0 | Among many other Python-centered companies, beyond the ones already mentioned by Unknown, I'd mention big pharma firms such as Astra-Zeneca, film studios such as Lucasfilm, and research places such as NASA, Caltech, Lawrence Livermore NRL.
Among the sponsors of Pycon Italia Tre (next week in Firenze, IT -- see www.pyco... | 3 | 21 | 0 | What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams.
It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller.
Are there some huge companies that devel... | Biggest python projects | 1 | 0 | 0 | 22,280 |
810,055 | 2009-05-01T03:24:00.000 | 8 | 1 | 1 | 0 | python | 810,992 | 4 | false | 0 | 0 | Our project is over 30,000 lines of Python. That's probably small by some standards. But it's plenty big enough to fill my little brain. The application is mentioned in our annual report, so it's "strategic" in that sense. We're not a "huge" company, so we don't really qualify.
A "huge company" (Fortune 1000?) does... | 3 | 21 | 0 | What is the biggest software development team that uses Python? I am wondering how well the dynamic type system scales to large development teams.
It's pretty clear that at Google they have C++ and Java codebases with thousands of developers; their use of Python is much smaller.
Are there some huge companies that devel... | Biggest python projects | 1 | 0 | 0 | 22,280 |
811,670 | 2009-05-01T14:41:00.000 | 3 | 0 | 1 | 0 | python,windows,security,excel | 811,736 | 5 | false | 0 | 0 | Sadly, Python is not very safe in this way, and this is quite well known. Its dynamic nature combined with the very thin layer over standard OS functionality makes it hard to lock things down. Usually the best option is to ensure the user running the app has limited rights, but I expect that is not practical. Another i... | 3 | 4 | 0 | I'm responsible for developing a large Python/Windows/Excel application used by a financial institution which has offices all round the world. Recently the regulations in one country have changed, and as a result we have been told that we need to create a "locked-down" version of our distribution.
After some frustratin... | How can I create a locked-down python environment? | 0.119427 | 0 | 0 | 1,040 |
811,670 | 2009-05-01T14:41:00.000 | 0 | 0 | 1 | 0 | python,windows,security,excel | 814,427 | 5 | false | 0 | 0 | I agree that you should examine the regulations to see what they actually require. If you really do need a "locked down" Python DLL, here's a way that might do it. It will probably take a while and won't be easy to get right. BTW, since this is theoretical, I'm waving my hands over work that varies from massive to tr... | 3 | 4 | 0 | I'm responsible for developing a large Python/Windows/Excel application used by a financial institution which has offices all round the world. Recently the regulations in one country have changed, and as a result we have been told that we need to create a "locked-down" version of our distribution.
After some frustratin... | How can I create a locked-down python environment? | 0 | 0 | 0 | 1,040 |
811,670 | 2009-05-01T14:41:00.000 | 9 | 0 | 1 | 0 | python,windows,security,excel | 811,711 | 5 | false | 0 | 0 | "reasonably safe" defined arbitrarily as "safer than Excel and VBA".
You can't win that fight. Because the fight is over the wrong thing. Anyone can use any EXE or DLL.
You need to define "locked down" differently -- in a way that you can succeed.
You need to define "locked down" as "cannot change the .PY files" or "... | 3 | 4 | 0 | I'm responsible for developing a large Python/Windows/Excel application used by a financial institution which has offices all round the world. Recently the regulations in one country have changed, and as a result we have been told that we need to create a "locked-down" version of our distribution.
After some frustratin... | How can I create a locked-down python environment? | 1 | 0 | 0 | 1,040 |
812,781 | 2009-05-01T19:03:00.000 | 28 | 1 | 0 | 1 | python,c,compiler-construction | 813,744 | 4 | false | 0 | 0 | Use your vendor's package management to add the package that contains the development files for bz2. It's usually a package called "libbz2-dev". E.g. on Ubuntu
sudo apt-get install libbz2-dev | 3 | 28 | 0 | It seems that Python 2.6.1 doesn't compile bz2 library by default from source.
I don't have lib-dynload/bz2.so
What's the quickest way to add it (without installing Python from scratch)?
OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux
IIRC I us... | Python's bz2 module not compiled by default | 1 | 0 | 0 | 40,171 |
812,781 | 2009-05-01T19:03:00.000 | 33 | 1 | 0 | 1 | python,c,compiler-construction | 813,112 | 4 | true | 0 | 0 | You need libbz2.so (the general purpose libbz2 library) properly installed first, for Python to be able to build its own interface to it. That would typically be from a package in your Linux distro likely to have "libbz2" and "dev" in the package name. | 3 | 28 | 0 | It seems that Python 2.6.1 doesn't compile bz2 library by default from source.
I don't have lib-dynload/bz2.so
What's the quickest way to add it (without installing Python from scratch)?
OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux
IIRC I us... | Python's bz2 module not compiled by default | 1.2 | 0 | 0 | 40,171 |
812,781 | 2009-05-01T19:03:00.000 | 9 | 1 | 0 | 1 | python,c,compiler-construction | 6,848,047 | 4 | false | 0 | 0 | If you happen to be trying to compile Python on RHEL5 the package is called bzip2-devel, and if you have RHN set up it can be installed with this command:
yum install bzip2-devel
Once that is done, you don't need either of the --enable-bz2 or --with-bz2 options, but you might need --enable-shared. | 3 | 28 | 0 | It seems that Python 2.6.1 doesn't compile bz2 library by default from source.
I don't have lib-dynload/bz2.so
What's the quickest way to add it (without installing Python from scratch)?
OS is Linux 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP Tue Jun 6 15:52:09 PDT 2006 i686 GNU/Linux
IIRC I us... | Python's bz2 module not compiled by default | 1 | 0 | 0 | 40,171 |
813,114 | 2009-05-01T20:25:00.000 | 5 | 0 | 0 | 0 | python,voip | 813,139 | 4 | false | 1 | 0 | I use twilio, very easy, very fun. | 1 | 2 | 0 | An artistic project will encourage users to ring a number and leave a voice-mail on an automated service. These voice-mails will be collected and edited into a half-hour radio show.
I want to make a temporary system (with as little as possible programming) which will:
Allow me to establish a public telephone number (... | I want to make a temporary answerphone which records MP3s | 0.244919 | 0 | 0 | 335 |
813,943 | 2009-05-02T01:37:00.000 | 8 | 0 | 0 | 0 | python,apache2,pylons,mod-wsgi | 814,005 | 2 | true | 1 | 0 | Nginx with mod_wsgi requires the use of a non-blocking asynchronous framework and setup and isn't likely to work out of box with Pylons.
I usually go with the proxy route to a stand-alone Pylons process using the PasteScript#cherrypy WSGI server (as its higher performing than the Paste#http one, though it won't recycle... | 1 | 4 | 0 | Or should I be using a totally different server? | If I want to use a pylons app with Apache, should I use mod_wsgi or proxy to paste? | 1.2 | 0 | 0 | 1,341 |
814,167 | 2009-05-02T04:52:00.000 | -2 | 1 | 0 | 0 | python | 814,535 | 7 | false | 0 | 0 | shutil.rmtree() is right answer, but just look at another useful function - os.walk() | 1 | 83 | 0 | What is the easiest way to do the equivalent of rm -rf in Python? | Easiest way to rm -rf in Python | -0.057081 | 0 | 0 | 31,538 |
814,896 | 2009-05-02T13:54:00.000 | 3 | 0 | 0 | 1 | python,database,google-app-engine,cron | 815,113 | 3 | false | 1 | 0 | I think you'll find that snapshotting every user's state every hour isn't something that will scale well no matter what your framework. A more ordinary environment will disguise this by letting you have longer running tasks, but you'll still reach the point where it's not practical to take a snapshot of every user's da... | 1 | 1 | 0 | I'm developing software using the Google App Engine.
I have some considerations about the optimal design regarding the following issue: I need to create and save snapshots of some entities at regular intervals.
In the conventional relational db world, I would create db jobs which would insert new summary records.
For ... | Google App Engine - design considerations about cron tasks | 0.197375 | 1 | 0 | 1,473 |
815,313 | 2009-05-02T18:17:00.000 | 2 | 1 | 0 | 0 | python,hash,twitter,md5 | 1,139,680 | 7 | false | 0 | 0 | There are a few issues here. First, RT's are not always identical. Some people add a comment. Others change the URL for tracking. Others add in the person that they are RT'ing (which may or may not be the originator).
So if you are going to hash the tweet, you need to boil it down to the meat of the tweet, and only... | 3 | 2 | 0 | In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database.
What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way.
My first a... | Detecting Retweets using computationally inexpensive Python hashing algorithms | 0.057081 | 0 | 0 | 798 |
815,313 | 2009-05-02T18:17:00.000 | 6 | 1 | 0 | 0 | python,hash,twitter,md5 | 815,317 | 7 | false | 0 | 0 | Do you really need to hash at all? Twitter messages are short enough (and disk space cheap enough) that it may be better to just store the whole message, rather than eating up clock cycles to hash it. | 3 | 2 | 0 | In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database.
What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way.
My first a... | Detecting Retweets using computationally inexpensive Python hashing algorithms | 1 | 0 | 0 | 798 |
815,313 | 2009-05-02T18:17:00.000 | 0 | 1 | 0 | 0 | python,hash,twitter,md5 | 817,731 | 7 | true | 0 | 0 | You are trying to hash a string right? Builtin types can be hashed right away, just do hash("some string") and you get some int. Its the same function python uses for dictonarys, so it is probably the best choice. | 3 | 2 | 0 | In order to be able to detect RT of a particular tweet, I plan to store hashes of each formatted tweet in the database.
What hashing algorithm should I use. Cryptic is of course not essential. Just a minimal way of storing a data as something which can then be compared if it is the same, in an efficient way.
My first a... | Detecting Retweets using computationally inexpensive Python hashing algorithms | 1.2 | 0 | 0 | 798 |
815,446 | 2009-05-02T19:25:00.000 | 1 | 1 | 1 | 0 | php,asp.net,python,webserver | 815,457 | 5 | false | 0 | 0 | Have you considered boo? It has a very configurable compiler and there are some good OSS examples out there (for example the brail view engine for Monorail & ASP.NET MVC). | 2 | 0 | 0 | I've just finished writing a web server in C#. Its pretty basic and only serves static content like html, xml, and images at the moment. I would like to implement a dynamic language, however. I'm trying to choose between one of the following:
ASP.NET
PHP
Python
I'd prefer to implement PHP or Python because I am much ... | C# Web Server: Implementing a Dynamic Language | 0.039979 | 0 | 0 | 1,357 |
815,446 | 2009-05-02T19:25:00.000 | 1 | 1 | 1 | 0 | php,asp.net,python,webserver | 815,550 | 5 | false | 0 | 0 | If you implement a cgi interface, you could use any kind of backend language. If you want to get fancy, you could consider looking into fastcgi. | 2 | 0 | 0 | I've just finished writing a web server in C#. Its pretty basic and only serves static content like html, xml, and images at the moment. I would like to implement a dynamic language, however. I'm trying to choose between one of the following:
ASP.NET
PHP
Python
I'd prefer to implement PHP or Python because I am much ... | C# Web Server: Implementing a Dynamic Language | 0.039979 | 0 | 0 | 1,357 |
815,969 | 2009-05-03T00:14:00.000 | 9 | 0 | 0 | 0 | python,distribution,probability,simpy | 815,994 | 3 | true | 0 | 0 | If you download the NumPy package, it has a function numpy.random.triangular(left, mode, right[, size]) that does exactly what you are looking for. | 2 | 7 | 0 | I want to run a simulation that uses as parameter a value generated from a triangular probability distribution with lower limit A, mode B and and upper limit C. How can I generate this value in Python? Is there something as simple as expovariate(lambda) (from random) for this distribution or do I have to code this thin... | Python, SimPy: How to generate a value from a triangular probability distribution? | 1.2 | 0 | 0 | 4,889 |
815,969 | 2009-05-03T00:14:00.000 | 6 | 0 | 0 | 0 | python,distribution,probability,simpy | 816,185 | 3 | false | 0 | 0 | Since, I was checking random's documentation from Python 2.4 I missed this:
random.triangular(low, high, mode)¶
Return a random floating point number N such that low <= N <= high and with the specified mode between those bounds. The low and high bounds default to zero and one. The mode argument defaults to the midp... | 2 | 7 | 0 | I want to run a simulation that uses as parameter a value generated from a triangular probability distribution with lower limit A, mode B and and upper limit C. How can I generate this value in Python? Is there something as simple as expovariate(lambda) (from random) for this distribution or do I have to code this thin... | Python, SimPy: How to generate a value from a triangular probability distribution? | 1 | 0 | 0 | 4,889 |
816,212 | 2009-05-03T03:09:00.000 | 14 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,248 | 13 | true | 1 | 1 | In general it's all of these things. Memory, speed, and probably most importantly programmer familiarity. Apple has a huge investment in Objective C, Java is known by basically everyone, and C# is very popular as well. If you're trying for mass programmer appeal it makes sense to start with something popular, even if i... | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 1.2 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 817,560 | 13 | false | 1 | 1 | webOS -- the new OS from Palm, which will debut on the Pre -- has you write apps against a webkit runtime in JavaScript. Time will tell how successful it is, but I suspect it will not be the first to go down this path. As mobile devices become more powerful, you'll see dynamic languages become more prevalent. | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,228 | 13 | false | 1 | 1 | Memory is also a significant factor. It's easy to eat memory in Python, unfortunately. | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 1,077,315 | 13 | false | 1 | 1 | There is a linux distribution for OpenMoko Freerunner called SHR. Most of its settings and framework code is written in python and... well, it isn't very fast. It is bearable, but it was planned from the beginning to rewrite it in Vala.
On the other side, my few smallish apps work fast enough (with the only drawback ha... | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 1 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,225 | 13 | false | 1 | 1 | I think that performance concerns may be part of, but not all of, the reason. Mobile devices do not have very powerful hardware to work with.
I am partly unsure about this, though. | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0.015383 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 1 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,233 | 13 | false | 1 | 1 | One of the most pressing matters is garbage collection. Garbage collection often times introduce unpredictable pauses in embedded machines which sometimes need real time performance.
This is why there is a Java Micro Edition which has a different garbage collector which reduces pauses in exchange for a slower program.
... | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0.015383 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,266 | 13 | false | 1 | 1 | There are many reasons. Among them:
business reasons, such as software lock-in strategies,
efficiency: dynamic languages are usually perceived to be slower (and in some cases really are slower, or at least provide a limit to the amount of optimsation you can do. On a mobile device, optimising code is necessary much mo... | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 1 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,219 | 13 | false | 1 | 1 | Jailbroken iPhones can have python installed, and I actually use python very frequently on mine. | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0.015383 | 0 | 0 | 3,120 |
816,212 | 2009-05-03T03:09:00.000 | 0 | 1 | 0 | 0 | python,ruby,mobile,operating-system,dynamic-languages | 816,217 | 13 | false | 1 | 1 | I suspect the basic reason is a combination of security and reliability. You don't want someone to be easily able to hack the phone, and you want to have some control over what's being installed. | 9 | 10 | 0 | I was wondering why smartphone/mobile device OSs are not written to allow dynamic languages as the language of choice? iPhone uses Objective-C, Google Android uses Java, Windows Mobile uses any manner of .NET language.
What would be the reasoning behind a mobile OS being written in Python, Ruby, or any other dynamic l... | Python/Ruby as mobile OS | 0 | 0 | 0 | 3,120 |
816,623 | 2009-05-03T09:02:00.000 | 23 | 0 | 1 | 0 | python-3.x,setuptools | 1,547,401 | 3 | true | 0 | 0 | Setuptools 0.7 and later supports Python 3.
Setuptools was in practice unmaintained for a long time, and this prompted several people to join together and make a fork, called "Distribute", which was ported to Python 3 since 2009.
However in 2013 the projects merged, and Setuptools and Distribute are now the same thing.... | 1 | 5 | 0 | I was trying to install "setuptool" package for python3.0. But unfortunately while
I try to install it says module names "dist" is missing.
pls help me to resolve this issue.
EDIT AS OF MARCH 2013:
please look below the accepted answer for a more upto date response by @LennartRegebro | setuptools on python3.0 | 1.2 | 0 | 0 | 14,591 |
816,704 | 2009-05-03T09:51:00.000 | 3 | 0 | 0 | 0 | python,selenium | 827,891 | 5 | false | 1 | 0 | To do this the way you want (to actually capture the content sent down to the browser) you'd need to modify Selenium RC's proxy code (see ProxyHandler.java) and store the files locally on the disk in parallel to sending the response back to the browser. | 2 | 9 | 0 | i'm trying to save an image from a website using selenium server & python client.
i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session.
the workaround i found so far is to save the page's screenshot (there are 2 sel... | save an image with selenium & firefox | 0.119427 | 0 | 1 | 9,916 |
816,704 | 2009-05-03T09:51:00.000 | -1 | 0 | 0 | 0 | python,selenium | 816,777 | 5 | false | 1 | 0 | How about going to the image URL and then taking a screenshot of the page? Firefox displays the image in full screen. Hope this helps.. | 2 | 9 | 0 | i'm trying to save an image from a website using selenium server & python client.
i know the image's URL, but i can't find the code to save it, either when it's the the document itself, or when it's embedded in the current browser session.
the workaround i found so far is to save the page's screenshot (there are 2 sel... | save an image with selenium & firefox | -0.039979 | 0 | 1 | 9,916 |
817,882 | 2009-05-03T20:11:00.000 | 1 | 0 | 0 | 0 | python,session | 817,940 | 5 | false | 0 | 0 | It can be as simple as creating a random number. Of course, you'd have to store your session IDs in a database or something and check each one you generate to make sure it's not a duplicate, but odds are it never will be if the numbers are large enough. | 1 | 46 | 0 | How do I generate a unique session id in Python? | Unique session id in python | 0.039979 | 0 | 0 | 42,141 |
817,884 | 2009-05-03T20:12:00.000 | 0 | 0 | 1 | 0 | python,dictionary | 817,902 | 5 | false | 0 | 0 | Just create a subclass of dict and add the keys in the init method.
class MyClass(dict)
def __init__(self):
"""Creates a new dict with default values""""
self['key1'] = 'value1'
Remember though, that in python any class that 'acts like a dict' is usually treated like one, so you don't have to worry too muc... | 1 | 4 | 0 | In python, is there a way to create a class that is treated like a dictionary but have the keys pre-defined when a new instance is created? | Creating dictionaries with pre-defined keys | 0 | 0 | 0 | 6,985 |
818,402 | 2009-05-04T00:20:00.000 | 3 | 1 | 0 | 0 | python,cgi | 818,405 | 6 | false | 1 | 0 | Yes.
Allow them to script their client, not your server. | 4 | 12 | 0 | I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I e... | Letting users upload Python scripts for execution | 0.099668 | 0 | 0 | 1,115 |
818,402 | 2009-05-04T00:20:00.000 | 4 | 1 | 0 | 0 | python,cgi | 818,558 | 6 | false | 1 | 0 | Along with other safeguards, you can also incorporate human review of the code. Assuming part of the experience is reviewing other members' solutions, and everyone is a python developer, don't allow new code to be activated until a certain number of members vote for it. Your users aren't going to approve malicious co... | 4 | 12 | 0 | I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I e... | Letting users upload Python scripts for execution | 0.132549 | 0 | 0 | 1,115 |
818,402 | 2009-05-04T00:20:00.000 | 1 | 1 | 0 | 0 | python,cgi | 819,227 | 6 | false | 1 | 0 | PyPy is probably a decent bet on the server side as suggested, but I'd look into having your python backend provide well defined APIs and data formats and have the users implement the AI and logic in Javascript so it can run in their browser. So the interaction would look like: For each match/turn/etc, pass data to the... | 4 | 12 | 0 | I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I e... | Letting users upload Python scripts for execution | 0.033321 | 0 | 0 | 1,115 |
818,402 | 2009-05-04T00:20:00.000 | 0 | 1 | 0 | 0 | python,cgi | 878,455 | 6 | true | 1 | 0 | Have an extensive API for the users and strip all other calls upon upload (such as import statements). Also, strip everything that has anything to do with file i/o.
(You might want to do multiple passes to ensure that you didn't miss anything.) | 4 | 12 | 0 | I understand that letting any anonymous user upload any sort of file in general can be dangerous, especially if it's code. However, I have an idea to let users upload custom AI scripts to my website. I would provide the template so that the user could compete with other AI's in an online web game I wrote in Python. I e... | Letting users upload Python scripts for execution | 1.2 | 0 | 0 | 1,115 |
818,458 | 2009-05-04T01:03:00.000 | 0 | 0 | 0 | 0 | python,tkinter | 818,490 | 10 | false | 0 | 1 | You have the source for idle. That shows useful tkinter code. | 3 | 2 | 0 | I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes. | How can I begin with Tkinter? | 0 | 0 | 0 | 1,839 |
818,458 | 2009-05-04T01:03:00.000 | 3 | 0 | 0 | 0 | python,tkinter | 7,546,018 | 10 | false | 0 | 1 | I used Manning's book on Tkinter, as someone else mentioned. The tutorials are very thorough, and you quickly get into the habit of thinking like a GUI coder. The New Mexico Tech worksheet is useful as a reference, but a bit too clumsy for a first resource. | 3 | 2 | 0 | I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes. | How can I begin with Tkinter? | 0.059928 | 0 | 0 | 1,839 |
818,458 | 2009-05-04T01:03:00.000 | 2 | 0 | 0 | 0 | python,tkinter | 1,035,813 | 10 | false | 0 | 1 | Mark Lutz's tome Programming Python deals at length with Tkinter. The Introduction to Tkinter ( effbot.org) and Tkinter reference: a GUI for Python (John Shipman, New Mexico Tech) are good summaries of the major features. I have read that the Tk/Tcl manual is a good reference but that might be for later. | 3 | 2 | 0 | I'm beginner for the GUI programing using Tkinter, so who can tell me some useful sample codes which contains some useful codes. | How can I begin with Tkinter? | 0.039979 | 0 | 0 | 1,839 |
818,752 | 2009-05-04T04:10:00.000 | 1 | 0 | 0 | 0 | php,python,mysql | 818,763 | 4 | false | 0 | 0 | Working on something you care about is the best way to learn programming, so I think this is a great idea.
I also recommend Python as a place to start. Have fun! | 1 | 2 | 0 | So, I've been tossing this idea around in my head for a while now. At its core, it's mostly a project for me to learn programming. The idea is that, I have a large set of data, my music collection. There are quite a few datasets that my music has. Format, artist, title, album, genre, length, year of release, filena... | Web-Based Music Library (programming concept) | 0.049958 | 1 | 0 | 2,085 |
818,942 | 2009-05-04T06:04:00.000 | 4 | 0 | 0 | 0 | python,user-interface,cross-platform,wxpython | 819,026 | 4 | true | 0 | 1 | The appearance of a dialog can change only if you use stock dialogs (like wx.FileDialog), if you make your own the layout will stay the same on every platform.
wx.Dialog has a CreateStdDialogButtonSizer method that creates a wx.StdDialogButtonSizer with standard buttons where you might see differences in layout on diff... | 3 | 2 | 0 | I'm learning wxPython so most of the libraries and classes are new to me.
I'm creating a Preferences dialog class but don't know the best way to make sure the OK/Cancel (or Save/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure th... | WxPython: Cross-Platform Way to Conform Ok/Cancel Button Order | 1.2 | 0 | 0 | 1,095 |
818,942 | 2009-05-04T06:04:00.000 | 0 | 0 | 0 | 0 | python,user-interface,cross-platform,wxpython | 819,330 | 4 | false | 0 | 1 | There's the GenericMessageDialog widget that should do the right thing depending on the platform (but I've never used it so I'm not sure it does). See the wxPython demo.
You can also use the SizedControls addon library (it's part of wxPython). The SizedDialog class helps to create dialogs that conform to the Human Int... | 3 | 2 | 0 | I'm learning wxPython so most of the libraries and classes are new to me.
I'm creating a Preferences dialog class but don't know the best way to make sure the OK/Cancel (or Save/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure th... | WxPython: Cross-Platform Way to Conform Ok/Cancel Button Order | 0 | 0 | 0 | 1,095 |
818,942 | 2009-05-04T06:04:00.000 | 0 | 0 | 0 | 0 | python,user-interface,cross-platform,wxpython | 819,110 | 4 | false | 0 | 1 | If you're going to use wx (or any other x-platform toolkit) you'd better trust that it does the right thing, mon!-) | 3 | 2 | 0 | I'm learning wxPython so most of the libraries and classes are new to me.
I'm creating a Preferences dialog class but don't know the best way to make sure the OK/Cancel (or Save/Close) buttons are in the correct order for the platform. This program is intended to run both on GNOME and Windows, so I want to make sure th... | WxPython: Cross-Platform Way to Conform Ok/Cancel Button Order | 0 | 0 | 0 | 1,095 |
819,217 | 2009-05-04T08:08:00.000 | 6 | 1 | 0 | 0 | python,cgi | 819,618 | 2 | false | 0 | 0 | This is a really bad design idea. Your script should be designed to work independently of how it's called. The calling programs should provide a uniform environment.
You'll be happiest if you design your scripts to work in exactly one consistent way. Build things like this.
myscript.py - the "real work" - defined i... | 1 | 3 | 0 | I have one Python module that can be called by a CGI script (passing it information from a form) or from the command line (passing it options and arguments from the command line).
Is there a way to establish if the module has been called from the CGI script or from the command line ?? | Python, who is calling my python module | 1 | 0 | 0 | 308 |
819,355 | 2009-05-04T08:59:00.000 | 2 | 0 | 0 | 0 | python,networking,ip-address,cidr | 10,053,031 | 28 | false | 0 | 0 | #This works properly without the weird byte by byte handling
def addressInNetwork(ip,net):
'''Is an address in a network'''
# Convert addresses to host order, so shifts actually make sense
ip = struct.unpack('>L',socket.inet_aton(ip))[0]
netaddr,bits = net.split('/')
netaddr = struct.unpack('>L',soc... | 1 | 123 | 0 | Given an ip address (say 192.168.0.1), how do I check if it's in a network (say 192.168.0.0/24) in Python?
Are there general tools in Python for ip address manipulation? Stuff like host lookups, ip adddress to int, network address with netmask to int and so on? Hopefully in the standard Python library for 2.5. | How can I check if an ip is in a network in Python? | 0.014285 | 0 | 1 | 174,240 |
820,742 | 2009-05-04T16:11:00.000 | 1 | 0 | 1 | 0 | python,string,multiple-inheritance,immutability | 820,750 | 5 | false | 0 | 0 | Perhaps a custom class that contains a string would be a better approach. Do you really need to pass all string methods through to the underlying string? Why not expose the string via a property and allow consumers of the class to do whatever they wish to it? | 2 | 6 | 0 | I want a string with one additional attribute, let's say whether to print it in red or green.
Subclassing(str) does not work, as it is immutable. I see the value, but it can be annoying.
Can multiple inheritence help? I never used that.
Inheriting only object and using self.value=str means I have to implement all strin... | How to bestow string-ness on my class? | 0.039979 | 0 | 0 | 1,664 |
820,742 | 2009-05-04T16:11:00.000 | 0 | 0 | 1 | 0 | python,string,multiple-inheritance,immutability | 820,767 | 5 | false | 0 | 0 | You need all of string's methods, so extend string and add your extra details. So what if string is immutable? Just make your class immutable, too. Then you're creating new objects anyway so you won't accidentally mess up thinking that it's a mutable object.
Or, if Python has one, extend a mutable variant of string. I'... | 2 | 6 | 0 | I want a string with one additional attribute, let's say whether to print it in red or green.
Subclassing(str) does not work, as it is immutable. I see the value, but it can be annoying.
Can multiple inheritence help? I never used that.
Inheriting only object and using self.value=str means I have to implement all strin... | How to bestow string-ness on my class? | 0 | 0 | 0 | 1,664 |
822,195 | 2009-05-04T21:39:00.000 | 1 | 0 | 1 | 0 | python,emacs,pabbrev | 14,367,349 | 3 | false | 0 | 0 | How is this for a late response?
This should work out of the box now, thanks to a patch from Trey. Binding tab in the way that pabbrev.el is somewhat naughty, but what are you to do if you want rapid expansion. | 1 | 3 | 0 | Normally when you hit tab on an empty line in emacs python mode it will cycle through the available tab indentations. When I hit tab when the point is at the deepest indent level I get the pabbrev buffer containing the last best match options. Does anyone else have this problem, is there an easy way around it without... | Emacs Pabbrev and Python | 0.066568 | 0 | 0 | 554 |
823,103 | 2009-05-05T02:52:00.000 | 1 | 1 | 1 | 0 | python,profiling | 823,117 | 4 | false | 0 | 0 | What if you monkey-patched object's class or another prototypical object?
This might not be the easiest if you're not using new-style classes. | 1 | 3 | 0 | Python is so dynamic that it's not always clear what's going on in a large program, and looking at a tiny bit of source code does not always help. To make matters worse, editors tend to have poor support for navigating to the definitions of tokens or import statements in a Python file.
One way to compensate might be t... | What's the best way to record the type of every variable assignment in a Python program? | 0.049958 | 0 | 0 | 235 |
825,694 | 2009-05-05T16:17:00.000 | 1 | 0 | 0 | 0 | python,dns,hostname | 828,397 | 3 | false | 1 | 0 | Your algorithm is the right one. Since zone cuts are not reflected in the domain name (you see domain cuts - the dots - but not zone cuts), it is the only correct one.
An approximate algorithm is to use a list of zones, like the one mentioned by Alnitak. Remember that these static lists are not authoritative, they lack... | 1 | 18 | 0 | Is there a programatic way to find the domain name from a given hostname?
given -> www.yahoo.co.jp
return -> yahoo.co.jp
The approach that works but is very slow is:
split on "." and remove 1 group from the left, join and query an SOA record using dnspython
when a valid SOA record is returned, consider that a domain
I... | Extract domain name from a host name | 0.066568 | 0 | 0 | 14,503 |
825,724 | 2009-05-05T16:22:00.000 | 0 | 0 | 0 | 0 | linux,ubuntu,wxpython | 876,524 | 1 | true | 0 | 1 | Robin Dunn himself told me that
It's using the "native" GTK file
dialog, just like the other apps, so
there isn't anything that wx can do
about it.
So as a workaround I ended up installing gvfs-fuse and browsing
the network through $HOME/.gvfs.. A bit klunky but it works. | 1 | 1 | 0 | I'm using wx.FileDialog in a wxPython 2.8.8.0 application, under Xubuntu 8.10.. My problem is that this dialog isn't network-aware, so I can't browse Samba shares.
I see that this problem plagues other applications too (Firefox, Audacious...) so I'd like to ask where I could find informations on how to make it work.
Is... | Network-aware wx.FileDialog | 1.2 | 0 | 1 | 276 |
825,909 | 2009-05-05T17:01:00.000 | 8 | 1 | 1 | 0 | python,exception-handling,try-catch,runtime-error | 826,144 | 6 | true | 0 | 0 | I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to differentiate between this RuntimeError and others that might be raised?
If the error is caused by a specific condition, the... | 1 | 8 | 0 | I'm importing a module which raises the following error in some conditions:
RuntimeError: pyparted requires root access
I know that I can just check for root access before the import, but I'd like to know how to catch this spesific kind of error via a try/except statement for future reference. Is there any way to d... | Catch only some runtime errors in Python | 1.2 | 0 | 0 | 24,955 |
826,724 | 2009-05-05T20:14:00.000 | 3 | 0 | 0 | 1 | python,google-app-engine,google-cloud-datastore,custompaging | 827,149 | 2 | true | 1 | 0 | There is no efficient way to do this - in any DBMS. In every case, you have to at least read sequentially through the index records until you find the nth one, then look up the corresponding data record. This is more or less what fetch(count, offset) does in GAE, with the additional limitation of 1000 records.
A better... | 1 | 1 | 0 | Suppose that I have the model Foo in GAE and this query:
query = Foo.all().order('-key')
I want to get the n-th record. What is the most efficient way to achieve that?
Will the solution break if the ordering property is not unique, such as the one below:
query = Foo.all().order('-color')
edit: n > 1000
edit 2: I want ... | how to get the n-th record of a datastore query | 1.2 | 0 | 0 | 845 |
827,295 | 2009-05-05T22:56:00.000 | 2 | 1 | 0 | 0 | python,unit-testing,dbus,hal | 827,391 | 2 | true | 0 | 0 | If you can not mock the environment then it's probably impossible for you to write the test.
If your access to HAL/D-Bus is via an object and you provide a mock instance to your test then it should be possible to emulate the necessary inputs to your test from the mock implementation. | 1 | 2 | 0 | How does one test a method that does some interactions with the local D-Bus (accessing a HAL object)?
Results of tests will differ depending on the system that the test is run on, so I don't know how to provide the method reliable input.
I'm working in Python, by the way. | Unit testing for D-Bus and HAL? | 1.2 | 0 | 0 | 441 |
827,415 | 2009-05-05T23:39:00.000 | 1 | 0 | 0 | 0 | python,django,web-applications,unicode,pylons | 1,440,981 | 4 | false | 1 | 0 | Using Unicode internally is a good way to avoid problems with non-ASCII characters. Convert at the boundaries of your application (incoming data to unicode, outgoing data to UTF-8 or whatever). Pylons can do the conversion for you in many cases: e.g. controllers can safely return unicode strings; SQLAlchemy models ma... | 2 | 6 | 0 | I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea.
On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere.
What will be a problem if I don't do this?
Are there any issues that will come up if I do do this?
I'm using ... | Should my python web app use unicode for all strings? | 0.049958 | 0 | 0 | 806 |
827,415 | 2009-05-05T23:39:00.000 | 3 | 0 | 0 | 0 | python,django,web-applications,unicode,pylons | 829,155 | 4 | false | 1 | 0 | What will be a problem if I don't do this?
I'm a westerner living in Japan, so I've seen first-hand what is needed to work with non-ASCII characters. The problem if you don't use Unicode strings is that your code will be a frustration to the parts of the world that use anything other than A-Z. Our company has had a gr... | 2 | 6 | 0 | I see some frameworks like Django using unicode all over the place so it seems like it might be a good idea.
On the other hand, it seems like a big pain to have all these extra 'u's floating around everywhere.
What will be a problem if I don't do this?
Are there any issues that will come up if I do do this?
I'm using ... | Should my python web app use unicode for all strings? | 0.148885 | 0 | 0 | 806 |
828,702 | 2009-05-06T08:56:00.000 | 2 | 0 | 0 | 0 | python,django,postgresql,caching,memcached | 828,826 | 5 | false | 1 | 0 | Short answer : If you have enougth ram, memcached will be always faster. You can't really benchhmark memcached vs. database cache, just keep in mind that the big bottleneck with servers is disk access, specially write access.
Anyway, disk cache is better if you have many objects to cache and long time expiration. But f... | 3 | 5 | 0 | I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db.
I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to k... | How to measure Django cache performance? | 0.07983 | 0 | 0 | 3,032 |
828,702 | 2009-05-06T08:56:00.000 | 0 | 0 | 0 | 0 | python,django,postgresql,caching,memcached | 2,105,437 | 5 | false | 1 | 0 | Just try it out. Use firebug or a similar tool and run memcache with a bit of RAM allocation (e.g. 64mb) on the test server.
Mark your average loading results seen in firebug without memcache, then turn caching on and mark new results. That's done as easy as it said.
The results usually shocks people, because the perfo... | 3 | 5 | 0 | I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db.
I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to k... | How to measure Django cache performance? | 0 | 0 | 0 | 3,032 |
828,702 | 2009-05-06T08:56:00.000 | 5 | 0 | 0 | 0 | python,django,postgresql,caching,memcached | 829,260 | 5 | true | 1 | 0 | At my previous work we tried to measure caching impact on site we was developing. On the same machine we load-tested the set of 10 pages that are most commonly used as start pages (object listings), plus some object detail pages taken randomly from the pool of ~200000. The difference was like 150 requests/second to 300... | 3 | 5 | 0 | I have a rather small (ca. 4.5k pageviews a day) website running on Django, with PostgreSQL 8.3 as the db.
I am using the database as both the cache and the sesssion backend. I've heard a lot of good things about using Memcached for this purpose, and I would definitely like to give it a try. However, I would like to k... | How to measure Django cache performance? | 1.2 | 0 | 0 | 3,032 |
828,862 | 2009-05-06T09:44:00.000 | 1 | 0 | 1 | 0 | python | 830,235 | 6 | false | 0 | 0 | I recently switched from python2.5 to 2.6 for my research project involving lots of 3rd party libs (scipy, pydot, etc.) and swig related stuff.
The only thing I had to change was to convert all strings with
s = unicode(s, "utf-8")
before I fed them into the logging module.
Otherwise, I got everytime
Traceback (mos... | 5 | 7 | 0 | Or should I just stick with Python2.5 for a bit longer? | Is Python2.6 stable enough for production use? | 0.033321 | 0 | 0 | 849 |
828,862 | 2009-05-06T09:44:00.000 | 1 | 0 | 1 | 0 | python | 829,464 | 6 | false | 0 | 0 | I've found 2.6 to be fairly good with two exceptions:
If you're using it on a server, I've had trouble in the past with some libraries which are used by elements of the server (Debian Etch IIRC). It's possible with a bit of jiggery pokery to maintain several versions of python in unison though if you're careful :-)
Th... | 5 | 7 | 0 | Or should I just stick with Python2.5 for a bit longer? | Is Python2.6 stable enough for production use? | 0.033321 | 0 | 0 | 849 |
828,862 | 2009-05-06T09:44:00.000 | 4 | 0 | 1 | 0 | python | 828,994 | 6 | false | 0 | 0 | Yes it it, but this is not the right question. The right question is "can I use Python 2.6, taking in consideration the incompatibilities it introduces ?". And the short answser is "most probably yes, unless you use a specific lib that wouldn't work with 2.6, which is pretty rare". | 5 | 7 | 0 | Or should I just stick with Python2.5 for a bit longer? | Is Python2.6 stable enough for production use? | 0.132549 | 0 | 0 | 849 |
828,862 | 2009-05-06T09:44:00.000 | 10 | 0 | 1 | 0 | python | 828,894 | 6 | false | 0 | 0 | Ubuntu has switched to 2.6 in it's latest release, and has not had any significant problems. So I would say "yes, it's stable". | 5 | 7 | 0 | Or should I just stick with Python2.5 for a bit longer? | Is Python2.6 stable enough for production use? | 1 | 0 | 0 | 849 |
828,862 | 2009-05-06T09:44:00.000 | 6 | 0 | 1 | 0 | python | 828,951 | 6 | false | 0 | 0 | It depends from libraries you use. For example there is no precompiled InformixDB package for 2.6 if you have to use Python on Windows.
Also web2py framework sticks with 2.5 because of some bug in 2.6.
Personally I use CPython 2.6 (workhorse) and 3.0 (experimental), and Jython 2.5 beta (for my test with JDBC and ODBC). | 5 | 7 | 0 | Or should I just stick with Python2.5 for a bit longer? | Is Python2.6 stable enough for production use? | 1 | 0 | 0 | 849 |
830,597 | 2009-05-06T16:51:00.000 | 0 | 0 | 0 | 1 | python,google-app-engine,exception-handling,web-applications | 833,840 | 2 | false | 1 | 0 | Ad. #4: I usually treat query strings as non-essential. If anything is wrong with query string, I'd just present bare resource page (as if no query was present), possibly with some information to user what was wrong with the query string.
This leads to the problem similar to your #3: how did the user got into this wron... | 1 | 6 | 0 | I'm developing a project on google app engine (webapp framework). I need you people to assess how I handle exceptions.
There are 4 types of exceptions I am handling:
Programming exceptions
Bad user input
Incorrect URLs
Incorrect query strings
Here is how I handle them:
I have subclassed the webapp.requesthandler cla... | design for handling exceptions - google app engine | 0 | 0 | 0 | 1,603 |
831,217 | 2009-05-06T19:11:00.000 | 1 | 0 | 1 | 0 | python,com | 7,378,250 | 2 | false | 0 | 0 | Given the lack of popularity of COM I've ended up providing XMLRPC interface at least I know how to diagnose errors if they occur. | 1 | 1 | 0 | I'd like to create a COM server that can hold it state across the calls. My goal is to have a thread-safe in-memory database. And provide an access to it via COM interface.
Is that possible? | How to make a persistent com server in Python | 0.099668 | 0 | 0 | 247 |
832,485 | 2009-05-07T01:12:00.000 | 1 | 0 | 1 | 0 | python | 832,590 | 6 | false | 0 | 0 | The short answer is just guess at what a good hash parameter would be that matches your ideas of "similar".
Probably just something like sum of all the letters (A) and the sum of the differences between adjacent letters (B), might work. For each new string, use its A and B values to quickly lookup a now much smaller ... | 1 | 3 | 0 | I have sets of strings in a database. Each set will have less than 500 members, there will be tens of thousands of sets, and the strings are natural language. I would like to detect duplicate strings within each set. New strings will be compared with an existing set, and added to the database if they are unique.
Are th... | Duplicate text detection / hashing | 0.033321 | 0 | 0 | 3,199 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.