title stringlengths 10 172 | question_id int64 469 40.1M | question_body stringlengths 22 48.2k | question_score int64 -44 5.52k | question_date stringlengths 20 20 | answer_id int64 497 40.1M | answer_body stringlengths 18 33.9k | answer_score int64 -38 8.38k | answer_date stringlengths 20 20 | tags list |
|---|---|---|---|---|---|---|---|---|---|
python: determine if a class is nested | 639,162 | <p>Suppose you have a python method that gets a type as parameter; is it possible to determine if the given type is a nested class?<br />
E.g. in this example:</p>
<pre><code>def show_type_info(t):
print t.__name__
# print outer class name (if any) ...
class SomeClass:
pass
class OuterClass:
class In... | 5 | 2009-03-12T15:26:53Z | 639,461 | <p>If you do not set it yourself, I do not believe that there is any way to determine if the class is nested. As anyway a Python class cannot be used as a namespace (or at least not easily), I would say that the best thing to do is simply use different files.</p>
| 0 | 2009-03-12T16:37:15Z | [
"python",
"introspection",
"inner-classes"
] |
python: determine if a class is nested | 639,162 | <p>Suppose you have a python method that gets a type as parameter; is it possible to determine if the given type is a nested class?<br />
E.g. in this example:</p>
<pre><code>def show_type_info(t):
print t.__name__
# print outer class name (if any) ...
class SomeClass:
pass
class OuterClass:
class In... | 5 | 2009-03-12T15:26:53Z | 639,492 | <p>Really a nested class is no different from any other class - it just happens to be defined somewhere else than the top-level namespace (inside another class instead). If we modify the description from "nested" to "non-top-level", then you may be able to come close enough to what you need.</p>
<p>eg:</p>
<pre><cod... | 4 | 2009-03-12T16:46:50Z | [
"python",
"introspection",
"inner-classes"
] |
python: determine if a class is nested | 639,162 | <p>Suppose you have a python method that gets a type as parameter; is it possible to determine if the given type is a nested class?<br />
E.g. in this example:</p>
<pre><code>def show_type_info(t):
print t.__name__
# print outer class name (if any) ...
class SomeClass:
pass
class OuterClass:
class In... | 5 | 2009-03-12T15:26:53Z | 639,588 | <p>Thank you all for your answers.<br />
I've found this possible solution using metaclasses; I've done it more for obstination than real need, and it's done in a way that will not be applicable to python 3.<br />
I want to share this solution anyway, so I'm posting it here. </p>
<pre><code>#!/usr/bin/env python
clas... | 1 | 2009-03-12T17:14:20Z | [
"python",
"introspection",
"inner-classes"
] |
PHP vs. long-running process (Python, Java, etc.)? | 639,409 | <p>I'd like to have your opinion about writing web apps in PHP vs. a long-running process using tools such as Django or Turbogears for Python.</p>
<p>As far as I know:
- In PHP, pages are fetched from the hard-disk every time (although I assume the OS keeps files in RAM for a while after they've been accessed)
- Pages... | 4 | 2009-03-12T16:22:12Z | 639,431 | <p>PHP is a language like Java etc.
Only your executable is the php binary and not the JVM! You can set another MAX-Runtime for PHP-Scripts without any problems (if your shared hosting provider let you do so).</p>
<p>Where your apps are running shouldn't depend on the kind of the server. It should depend on the resso... | -1 | 2009-03-12T16:27:05Z | [
"php",
"python"
] |
PHP vs. long-running process (Python, Java, etc.)? | 639,409 | <p>I'd like to have your opinion about writing web apps in PHP vs. a long-running process using tools such as Django or Turbogears for Python.</p>
<p>As far as I know:
- In PHP, pages are fetched from the hard-disk every time (although I assume the OS keeps files in RAM for a while after they've been accessed)
- Pages... | 4 | 2009-03-12T16:22:12Z | 639,435 | <p>PHP is fine for either use in my opinion, the performance overheads are rarely noticed. It's usually other processes which will delay the program. It's easy to cache PHP programs with something like eAccelerator.</p>
| 1 | 2009-03-12T16:28:02Z | [
"php",
"python"
] |
PHP vs. long-running process (Python, Java, etc.)? | 639,409 | <p>I'd like to have your opinion about writing web apps in PHP vs. a long-running process using tools such as Django or Turbogears for Python.</p>
<p>As far as I know:
- In PHP, pages are fetched from the hard-disk every time (although I assume the OS keeps files in RAM for a while after they've been accessed)
- Pages... | 4 | 2009-03-12T16:22:12Z | 639,489 | <ul>
<li>With <a href="http://www.php.net/manual/en/book.apc.php" rel="nofollow">APC</a>, which is soon to be included by default in PHP compiled bytecode is kept in RAM. </li>
<li>With mod_php, which is the most popular way to use PHP, the PHP interpreter stays in web server's memory.</li>
<li>With <a href="http://www... | 2 | 2009-03-12T16:45:46Z | [
"php",
"python"
] |
PHP vs. long-running process (Python, Java, etc.)? | 639,409 | <p>I'd like to have your opinion about writing web apps in PHP vs. a long-running process using tools such as Django or Turbogears for Python.</p>
<p>As far as I know:
- In PHP, pages are fetched from the hard-disk every time (although I assume the OS keeps files in RAM for a while after they've been accessed)
- Pages... | 4 | 2009-03-12T16:22:12Z | 639,537 | <p>After you apply memcache, opcode caching, and connection pooling, the only real difference between PHP and other options is that PHP is short-lived, processed based, while other options are, typically, long-lived multithreaded based.</p>
<p>The advantage PHP has is that its dirt simple to write scripts. You don't ... | 2 | 2009-03-12T17:00:05Z | [
"php",
"python"
] |
PHP vs. long-running process (Python, Java, etc.)? | 639,409 | <p>I'd like to have your opinion about writing web apps in PHP vs. a long-running process using tools such as Django or Turbogears for Python.</p>
<p>As far as I know:
- In PHP, pages are fetched from the hard-disk every time (although I assume the OS keeps files in RAM for a while after they've been accessed)
- Pages... | 4 | 2009-03-12T16:22:12Z | 640,138 | <p>As many others have noted, PHP nor Django are going to be your bottlenecks. Hitting the hard disk for the bytecode on PHP is irrelevant for a heavily trafficked site because caching will take over at that point. The same is true for Django.</p>
<p>Model/View and user experience design will have order of magnitude... | 0 | 2009-03-12T19:26:09Z | [
"php",
"python"
] |
Running unit tests with Nose inside a Python environment such as Autodesk Maya? | 639,744 | <p>I'd like to start creating unit tests for my Maya scripts. These scripts must be run inside the Maya environment and rely on the <code>maya.cmds</code> module namespace.</p>
<p>How can I run Nose tests from inside a running environment such as Maya?</p>
| 6 | 2009-03-12T17:49:21Z | 640,472 | <p>Use the mayapy executable included in your maya install instead of the standard python executable.</p>
<p>In order for this work you'll need to run nose programmatically. Create a python file called <code>runtests.py</code> and put it next to your test files. In it, include the following code:</p>
<pre><code>imp... | 15 | 2009-03-12T21:03:01Z | [
"python",
"unit-testing",
"environment",
"nose",
"maya"
] |
Setting object owner with generic create_object view in django | 639,792 | <p>Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?</p>
<p>P.E:</p>
<pre><code>class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
</code></pre>
<p>What I want is to use create_object and fill author with req... | 10 | 2009-03-12T18:02:08Z | 640,058 | <p>If a user is authenticated, their user object is the <code>request.user</code> object.</p>
<p>I'm not familiar with create_object... I'm still a beginner to django and have only just started my first real project with it.</p>
<p>Note that you should check to make sure a user is logged in before using this. This c... | 1 | 2009-03-12T19:08:59Z | [
"python",
"django"
] |
Setting object owner with generic create_object view in django | 639,792 | <p>Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?</p>
<p>P.E:</p>
<pre><code>class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
</code></pre>
<p>What I want is to use create_object and fill author with req... | 10 | 2009-03-12T18:02:08Z | 640,318 | <p>In many ways, all the solutions to this will be more trouble than they are worth. This one qualifies as a hack. It is possible for a django update to leave you high and dry if they change the way create_update is implemented. For simplicity sake, I'll assume that you are trying to set a default user, not silently... | 2 | 2009-03-12T20:22:47Z | [
"python",
"django"
] |
Setting object owner with generic create_object view in django | 639,792 | <p>Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?</p>
<p>P.E:</p>
<pre><code>class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
</code></pre>
<p>What I want is to use create_object and fill author with req... | 10 | 2009-03-12T18:02:08Z | 643,999 | <p>There is no good way to hook into the saving of an object when using the current Django generic views. Once they are <a href="http://code.djangoproject.com/ticket/6735" rel="nofollow">rewritten as classes</a>, you'll be able to subclass the view and hook in at the proper place without having to rewrite the whole vi... | 0 | 2009-03-13T18:24:55Z | [
"python",
"django"
] |
Setting object owner with generic create_object view in django | 639,792 | <p>Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?</p>
<p>P.E:</p>
<pre><code>class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
</code></pre>
<p>What I want is to use create_object and fill author with req... | 10 | 2009-03-12T18:02:08Z | 792,330 | <p>I would suggest to make a wrapper for the create_object, as this author suggest
<a href="http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/" rel="nofollow">http://www.b-list.org/weblog/2006/nov/16/django-tips-get-most-out-generic-views/</a>
in the view you'll have access to the user inf... | 0 | 2009-04-27T05:23:45Z | [
"python",
"django"
] |
Setting object owner with generic create_object view in django | 639,792 | <p>Is it possible to use create_object view to create a new object and automatically asign request.user as foreign key?</p>
<p>P.E:</p>
<pre><code>class Post(models.Model):
text = models.TextField()
author = models.ForeignKey(User)
</code></pre>
<p>What I want is to use create_object and fill author with req... | 10 | 2009-03-12T18:02:08Z | 1,829,358 | <p>You may want to consider a closure.</p>
<pre><code>from django.forms import ModelForm
from django.views.generic.create_update import create_object, update_object
def make_foo_form(request):
class FooForm(ModelForm):
class Meta:
model = Foo
fields = ['foo', 'bar']
def sa... | 3 | 2009-12-01T22:21:53Z | [
"python",
"django"
] |
Python: Incrementally marshal / pickle an object? | 639,821 | <p>I have a large object I'd like to serialize to disk. I'm finding <a href="http://www.python.org/doc/2.5.2/lib/module-marshal.html" rel="nofollow">marshal</a> works quite well and is nice and fast. </p>
<p>Right now I'm creating my large object then calling marshal.dump . I'd like to avoid holding the large object i... | 4 | 2009-03-12T18:08:33Z | 640,094 | <p>This very much depends on how you are building the object. Is it an array of sub objects? You could marshal/pickle each array element as you build it. Is it a dictionary? Same idea applies (marshal/pickle keys)</p>
<p>If it is just a big complex harry object, you might want to marshal dump each piece of the object,... | 0 | 2009-03-12T19:14:21Z | [
"python",
"serialization",
"data-structures",
"memory-management"
] |
Python: Incrementally marshal / pickle an object? | 639,821 | <p>I have a large object I'd like to serialize to disk. I'm finding <a href="http://www.python.org/doc/2.5.2/lib/module-marshal.html" rel="nofollow">marshal</a> works quite well and is nice and fast. </p>
<p>Right now I'm creating my large object then calling marshal.dump . I'd like to avoid holding the large object i... | 4 | 2009-03-12T18:08:33Z | 641,175 | <p>You should be able to dump the item piece by piece to the file. The two design questions that need settling are:</p>
<ol>
<li>How are you building the object when you're putting it in memory?</li>
<li>How do you need you're data when it comes out of memory?</li>
</ol>
<p>If your build process populates the entire... | 0 | 2009-03-13T01:37:54Z | [
"python",
"serialization",
"data-structures",
"memory-management"
] |
Python: Incrementally marshal / pickle an object? | 639,821 | <p>I have a large object I'd like to serialize to disk. I'm finding <a href="http://www.python.org/doc/2.5.2/lib/module-marshal.html" rel="nofollow">marshal</a> works quite well and is nice and fast. </p>
<p>Right now I'm creating my large object then calling marshal.dump . I'd like to avoid holding the large object i... | 4 | 2009-03-12T18:08:33Z | 645,112 | <p>The bsddb module's 'hashopen' and 'btopen' functions provide a persistent dictionary-like interface. Perhaps you could use one of these, instead of a regular dictionary, to incrementally serialize the arrays to disk?</p>
<pre><code>import bsddb
import marshal
db = bsddb.hashopen('file.db')
db['array1'] = marshal.d... | 4 | 2009-03-14T00:57:24Z | [
"python",
"serialization",
"data-structures",
"memory-management"
] |
Python: Incrementally marshal / pickle an object? | 639,821 | <p>I have a large object I'd like to serialize to disk. I'm finding <a href="http://www.python.org/doc/2.5.2/lib/module-marshal.html" rel="nofollow">marshal</a> works quite well and is nice and fast. </p>
<p>Right now I'm creating my large object then calling marshal.dump . I'd like to avoid holding the large object i... | 4 | 2009-03-12T18:08:33Z | 645,574 | <p>It all your object has to do is be a dictionary of lists, then you may be able to use the <a href="http://www.python.org/doc/2.5.2/lib/module-shelve.html" rel="nofollow">shelve module</a>. It presents a dictionary-like interface where the keys and values are stored in a database file instead of in memory. One limita... | 4 | 2009-03-14T07:22:53Z | [
"python",
"serialization",
"data-structures",
"memory-management"
] |
Validating Oracle dates in Python | 639,949 | <p>Our Python CMS stores some date values in a generic "attribute" table's <em>varchar</em> column. Some of these dates are later moved into a table with an actual <em>date</em> column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string dat... | 1 | 2009-03-12T18:41:20Z | 640,036 | <blockquote>
<p>How can I use Python to make sure that all dates put into our CMS are valid Oracle string date representations?</p>
</blockquote>
<p>I'd change the approach a bit. Have Python parse the original date input as forgivingly as possible, then output the date in a known-good representation.</p>
<p><a hre... | 5 | 2009-03-12T19:03:31Z | [
"python",
"oracle",
"validation"
] |
Validating Oracle dates in Python | 639,949 | <p>Our Python CMS stores some date values in a generic "attribute" table's <em>varchar</em> column. Some of these dates are later moved into a table with an actual <em>date</em> column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string dat... | 1 | 2009-03-12T18:41:20Z | 640,115 | <p>The format of a date string that Oracle recognizes as a date is a configurable property of the database and as such it's considered bad form to rely on implicit conversions of strings to dates.</p>
<p>Typically Oracle dates format to 'DD-MON-YYYY' but you can't always rely on it being set that way.</p>
<p>Personal... | 1 | 2009-03-12T19:18:18Z | [
"python",
"oracle",
"validation"
] |
Validating Oracle dates in Python | 639,949 | <p>Our Python CMS stores some date values in a generic "attribute" table's <em>varchar</em> column. Some of these dates are later moved into a table with an actual <em>date</em> column. If the CMS user entered an invalid date, it doesn't get caught until the migration, when the query fails with an "Invalid string dat... | 1 | 2009-03-12T18:41:20Z | 640,153 | <p>Validate as early as possible. Why don't you store dates as dates in your Python CMS? </p>
<p>It is difficult to know what date a string like '03-04-2008' is. Is it 3 april 2008 or 4 march 2008? An American will say 4 march 2008 but a Dutch person will say 3 april 2008. </p>
| -1 | 2009-03-12T19:33:41Z | [
"python",
"oracle",
"validation"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 640,032 | <p>There's a very easy way if you're using Python 2.6: the <a href="http://docs.python.org/library/zipfile.html#zipfile.ZipFile.extractall" rel="nofollow">extractall</a> method.</p>
<p>However, since the <code>zipfile</code> module is implemented completely in Python without any C extensions, you can probably copy it ... | 2 | 2009-03-12T19:03:04Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 640,033 | <p>It sounds like you are trying to run unzip to extract the zip.</p>
<p>It would be better to use the python <a href="http://docs.python.org/library/zipfile.html" rel="nofollow"><code>zipfile</code></a> module, and therefore do the extraction in python.</p>
<pre><code>import zipfile
def extract(zipfilepath, extract... | 1 | 2009-03-12T19:03:11Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 640,078 | <p>The extract and extractall methods are great if you're on Python 2.6. I have to use Python 2.5 for now, so I just need to create the directories if they don't exist. You can get a listing of directories with the <code>namelist()</code> method. The directories will always end with a forward slash (even on Windows)... | 21 | 2009-03-12T19:11:36Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 640,080 | <p>I tried this out, and can reproduce it. The extractall method, as suggested by other answers, does <strong>not</strong> solve the problem. This seems like a bug in the zipfile module to me (perhaps Windows-only?), unless I'm misunderstanding how zipfiles are structured.</p>
<pre><code>testa\
testa\testb\
testa\te... | 5 | 2009-03-12T19:11:42Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 641,100 | <p><strong>Don't</strong> trust extract() or extractall().</p>
<p>These methods blindly extract files to the paths given in their filenames. But ZIP filenames can be anything at all, including dangerous strings like âx/../../../etc/passwdâ. Extract such files and you could have just compromised your entire server.... | 14 | 2009-03-13T00:56:12Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 2,346,007 | <p>Note that zip files can have entries for directories as well as files. When creating archives with the <code>zip</code> command, pass the <code>-D</code> option to disable adding directory entries explicitly to the archive. When Python 2.6's <code>ZipFile.extractall</code> method runs across a directory entry, it se... | 0 | 2010-02-27T02:27:24Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 6,478,402 | <p>I know it may be a little late to say this but Jeff is right.
It's as simple as:</p>
<pre><code>import os
from zipfile import ZipFile as zip
def extractAll(zipName):
z = zip(zipName)
for f in z.namelist():
if f.endswith('/'):
os.makedirs(f)
else:
z.extract(f)
if __n... | 4 | 2011-06-25T14:32:43Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 12,130,069 | <h2>Filter namelist to exclude the folders</h2>
<p>All you have to do is filter out the <code>namelist()</code> entries ending with <code>/</code> and the problem is resolved: </p>
<pre><code> z.extractall(dest, filter(lambda f: not f.endswith('/'), z.namelist()))
</code></pre>
<p>nJoy!</p>
| 1 | 2012-08-26T12:20:07Z | [
"python",
"unzip"
] |
Unzipping directory structure with python | 639,962 | <p>I have a zip file which contains the following directory structure:</p>
<pre><code>dir1\dir2\dir3a
dir1\dir2\dir3b
</code></pre>
<p>I'm trying to unzip it and maintain the directory structure however I get the error:</p>
<pre><code>IOError: [Errno 2] No such file or directory: 'C:\\\projects\\\testFolder\\\subdir... | 26 | 2009-03-12T18:44:45Z | 29,133,705 | <p>If like me, you have to extract a complete zip archive with an older Python release (in my case, 2.4) here's what I came up with (based on Jeff's answer):</p>
<pre><code>import zipfile
import os
def unzip(source_file_path, destination_dir):
destination_dir += '/'
z = zipfile.ZipFile(source_file_path, 'r')
... | 0 | 2015-03-18T22:13:22Z | [
"python",
"unzip"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,016 | <pre><code>s/\([^)]*\)//
</code></pre>
<p>So in Python, you'd do:</p>
<pre><code>re.sub(r'\([^)]*\)', '', filename)
</code></pre>
| 57 | 2009-03-12T18:59:43Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,038 | <p>If you can stand to use <code>sed</code> (possibly execute from within your program, it'd be as simple as:</p>
<pre><code>sed 's/(.*)//g'
</code></pre>
| 2 | 2009-03-12T19:03:40Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,054 | <p>I would use:</p>
<pre><code>\([^)]*\)
</code></pre>
| 15 | 2009-03-12T19:08:27Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,250 | <p>If a path may contain parentheses then the <code>r'\(.*?\)'</code> regex is not enough:</p>
<pre><code>import os, re
def remove_parenthesized_chunks(path, safeext=True, safedir=True):
dirpath, basename = os.path.split(path) if safedir else ('', path)
name, ext = os.path.splitext(basename) if safeext else (... | 3 | 2009-03-12T20:03:48Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,630 | <pre><code>>>> import re
>>> filename = "Example_file_(extra_descriptor).ext"
>>> p = re.compile(r'\([^)]*\)')
>>> re.sub(p, '', filename)
'Example_file_.ext'
</code></pre>
| 0 | 2009-03-12T21:48:15Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 640,819 | <p>If you don't absolutely need to use a regex, <strike>use</strike>consider using Perl's <a href="http://perldoc.perl.org/Text/Balanced.html">Text::Balanced</a> to remove the parenthesis.</p>
<pre><code>use Text::Balanced qw(extract_bracketed);
my ($extracted, $remainder, $prefix) = extract_bracketed( $filename, '()... | 5 | 2009-03-12T22:55:18Z | [
"python",
"regex",
"perl"
] |
How can I remove text within parentheses with a regex? | 640,001 | <p>I'm trying to handle a bunch of files, and I need to alter then to remove extraneous information in the filenames; notably, I'm trying to remove text inside parentheses. For example:</p>
<pre><code>filename = "Example_file_(extra_descriptor).ext"
</code></pre>
<p>and I want to regex a whole bunch of files where th... | 33 | 2009-03-12T18:56:57Z | 11,793,027 | <p>Java code:</p>
<pre><code>Pattern pattern1 = Pattern.compile("(\\_\\(.*?\\))");
System.out.println(fileName.replace(matcher1.group(1), ""));
</code></pre>
| 0 | 2012-08-03T09:30:47Z | [
"python",
"regex",
"perl"
] |
What's the nearest equivalent of Beautiful Soup for Ruby? | 640,068 | <p>I love the Beautiful Soup scraping library in Python. It just works. Is there a close equivalent in Ruby? </p>
| 11 | 2009-03-12T19:10:29Z | 640,104 | <p><a href="http://wiki.github.com/why/hpricot" rel="nofollow">Hpricot</a>? I don't know what others are using...</p>
| 1 | 2009-03-12T19:16:05Z | [
"python",
"ruby",
"beautifulsoup"
] |
What's the nearest equivalent of Beautiful Soup for Ruby? | 640,068 | <p>I love the Beautiful Soup scraping library in Python. It just works. Is there a close equivalent in Ruby? </p>
| 11 | 2009-03-12T19:10:29Z | 640,129 | <p>There's <a href="https://github.com/scrubber/scrubyt" rel="nofollow">scRUBYt!</a>,
<a href="http://www.crummy.com/software/RubyfulSoup/" rel="nofollow">Rubyful-soup</a> (no longer maintained),
<a href="http://rubyforge.org/projects/mechanize/" rel="nofollow">WWW::Mechanize</a>,
<a href="http://blog.labnotes.org/2006... | 4 | 2009-03-12T19:24:00Z | [
"python",
"ruby",
"beautifulsoup"
] |
What's the nearest equivalent of Beautiful Soup for Ruby? | 640,068 | <p>I love the Beautiful Soup scraping library in Python. It just works. Is there a close equivalent in Ruby? </p>
| 11 | 2009-03-12T19:10:29Z | 640,135 | <p><a href="http://wiki.github.com/tenderlove/nokogiri">Nokogiri</a> is another HTML/XML parser. It's faster than hpricot according to <a href="http://gist.github.com/18533">these benchmarks</a>. Nokogiri uses libxml2 and is a drop in replacement for hpricot. It also has css3 selector support which is pretty nice.</p>
... | 8 | 2009-03-12T19:25:16Z | [
"python",
"ruby",
"beautifulsoup"
] |
What's the nearest equivalent of Beautiful Soup for Ruby? | 640,068 | <p>I love the Beautiful Soup scraping library in Python. It just works. Is there a close equivalent in Ruby? </p>
| 11 | 2009-03-12T19:10:29Z | 1,718,308 | <p>This page from <a href="https://www.ruby-toolbox.com/categories/html_parsing" rel="nofollow">Ruby Toolbox</a> includes a chart of the relative popularity of various parsers.</p>
| 2 | 2009-11-11T21:46:08Z | [
"python",
"ruby",
"beautifulsoup"
] |
Can I override the html_name for a tabularinline field in the admin interface? | 640,218 | <p><strong>Is it possible to override the html naming of fields in TabularInline admin forms so they won't contain dashes?</strong></p>
<p>I'm trying to apply the knowledge obtained <a href="http://jannisleidel.com/2008/11/autocomplete-form-widget-foreignkey-model-fields/" rel="nofollow">here</a> to create a TabularIn... | 0 | 2009-03-12T19:54:32Z | 643,019 | <p>Paolo and Guðmundur are right. I modified my usage in the javascript according to Guðmundur's suggestion and things now work as expected - no django intervention needed.</p>
<p>Sorry for the mental lapse...</p>
<p>Thanks!</p>
| 0 | 2009-03-13T14:42:35Z | [
"python",
"django",
"django-admin",
"django-forms"
] |
How do I upload a file with mod_python? | 640,310 | <p>I want to create a simple file upload form and I must be completely incapable. I've read docs and tutorials,but for some reason, I'm not getting the submitted form data. I wrote the smallest amount of code I could to test and it still isn't working. Any ideas what's wrong?</p>
<pre><code>def index():
html = '''... | 3 | 2009-03-12T20:21:02Z | 640,650 | <p>try putting enctype="multipart/form-data" in your form tag. Your mistake is not really mod_python related.</p>
| 1 | 2009-03-12T21:54:06Z | [
"python",
"upload",
"mod-python"
] |
tell whether python is in -i mode | 640,389 | <p>How can you tell whether python has been started with the -i flag?</p>
<p>According to <a href="http://www.wingware.com/psupport/python-manual/2.6/using/cmdline.html" rel="nofollow">the docs</a>, you can check the PYTHONINSPECT variable in os.environ, which is the <em>equivalent</em> of -i. But apparently it doesn'... | 5 | 2009-03-12T20:38:47Z | 640,405 | <p>This specifies <a href="http://mail.python.org/pipermail/python-list/2005-April/319756.html" rel="nofollow">how to programatically switch your script to interactive mode</a>.</p>
| 0 | 2009-03-12T20:44:32Z | [
"python"
] |
tell whether python is in -i mode | 640,389 | <p>How can you tell whether python has been started with the -i flag?</p>
<p>According to <a href="http://www.wingware.com/psupport/python-manual/2.6/using/cmdline.html" rel="nofollow">the docs</a>, you can check the PYTHONINSPECT variable in os.environ, which is the <em>equivalent</em> of -i. But apparently it doesn'... | 5 | 2009-03-12T20:38:47Z | 640,431 | <h3>How to set inspect mode programmatically</h3>
<p>The answer from <a href="http://mail.python.org/pipermail/python-list/2005-April/319756.html" rel="nofollow">the link</a> <a href="http://stackoverflow.com/questions/640389/tell-whether-python-is-in-i-mode/640405#640405">@Jweede provided</a> is imprecise. It should ... | 3 | 2009-03-12T20:53:17Z | [
"python"
] |
tell whether python is in -i mode | 640,389 | <p>How can you tell whether python has been started with the -i flag?</p>
<p>According to <a href="http://www.wingware.com/psupport/python-manual/2.6/using/cmdline.html" rel="nofollow">the docs</a>, you can check the PYTHONINSPECT variable in os.environ, which is the <em>equivalent</em> of -i. But apparently it doesn'... | 5 | 2009-03-12T20:38:47Z | 640,534 | <p>I took a look at the source, and although the variable set when -i is provided is stored in Py_InteractiveFlag, it doesn't look like it gets exposed to python.</p>
<p>However, if you don't mind getting your hands a bit dirty with some low-level ctypes inspecting, I think you can get at the value by:</p>
<pre><code... | 1 | 2009-03-12T21:21:17Z | [
"python"
] |
Python introspection: How to get an 'unsorted' list of object attributes? | 640,479 | <p>The following code</p>
<pre><code>import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
</code></pre>
<p>outputs</p>
<pre><code>C
D
</code></pre>
<p>How do I get it to output in the order in which these classes wer... | 4 | 2009-03-12T21:04:56Z | 640,503 | <p>AFAIK, no -- there isn't*. This is because all of a class's attributes are stored in a dictionary (which is, as you know, unordered).</p>
<p>*: it might actually be possible, but that would require either decorators or possibly metaclass hacking. Do either of those interest you?</p>
| 1 | 2009-03-12T21:13:00Z | [
"python",
"introspection",
"python-datamodel"
] |
Python introspection: How to get an 'unsorted' list of object attributes? | 640,479 | <p>The following code</p>
<pre><code>import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
</code></pre>
<p>outputs</p>
<pre><code>C
D
</code></pre>
<p>How do I get it to output in the order in which these classes wer... | 4 | 2009-03-12T21:04:56Z | 640,507 | <p>No, you can't get those attributes in the order you're looking for. Python attributes are stored in a dict (read: hashmap), which has no awareness of insertion order. </p>
<p>Also, I would avoid the use of eval by simply saying</p>
<pre><code>if type(getattr(A, d)) is types.ClassType:
print d
</code></pre>
... | 5 | 2009-03-12T21:14:07Z | [
"python",
"introspection",
"python-datamodel"
] |
Python introspection: How to get an 'unsorted' list of object attributes? | 640,479 | <p>The following code</p>
<pre><code>import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
</code></pre>
<p>outputs</p>
<pre><code>C
D
</code></pre>
<p>How do I get it to output in the order in which these classes wer... | 4 | 2009-03-12T21:04:56Z | 640,578 | <p>I'm not trying to be glib here, but would it be feasible for you to organize the classes in your source alphabetically? i find that when there are lots of classes in one file this can be useful in its own right.</p>
| 0 | 2009-03-12T21:33:47Z | [
"python",
"introspection",
"python-datamodel"
] |
Python introspection: How to get an 'unsorted' list of object attributes? | 640,479 | <p>The following code</p>
<pre><code>import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
</code></pre>
<p>outputs</p>
<pre><code>C
D
</code></pre>
<p>How do I get it to output in the order in which these classes wer... | 4 | 2009-03-12T21:04:56Z | 640,638 | <p>Note that that parsing is already done for you in inspect - take a look at <code>inspect.findsource</code>, which searches the module for the class definition and returns the source and line number. Sorting on that line number (you may also need to split out classes defined in separate modules) should give the righ... | 8 | 2009-03-12T21:51:30Z | [
"python",
"introspection",
"python-datamodel"
] |
Python introspection: How to get an 'unsorted' list of object attributes? | 640,479 | <p>The following code</p>
<pre><code>import types
class A:
class D:
pass
class C:
pass
for d in dir(A):
if type(eval('A.'+d)) is types.ClassType:
print d
</code></pre>
<p>outputs</p>
<pre><code>C
D
</code></pre>
<p>How do I get it to output in the order in which these classes wer... | 4 | 2009-03-12T21:04:56Z | 640,682 | <p>The <code>inspect</code> module also has the <code>findsource</code> function. It returns a tuple of source lines and line number where the object is defined.</p>
<pre><code>>>> import inspect
>>> import StringIO
>>> inspect.findsource(StringIO.StringIO)[1]
41
>>>
</code></pre>
... | 4 | 2009-03-12T22:03:07Z | [
"python",
"introspection",
"python-datamodel"
] |
Formatted text in GAE | 640,733 | <p>Google app engine question: What is a good way to take formatted text (does not have to be rich text) from the user and then store it in a text or blog property in the datastore? Mainly what I'm looking for is it to store newlines and strings of spaces, so that the text comes back looking the same as when it was sub... | 3 | 2009-03-12T22:22:32Z | 640,776 | <p>The text will always "come back" the same as how you put it in. You will lose some formatting rendering to HTML (as you noticed line endings and spaces). One solution might be to render the text into a <code><pre></code> <a href="http://www.w3schools.com/TAGS/tag%5Fpre.asp" rel="nofollow">element (which implie... | 2 | 2009-03-12T22:41:52Z | [
"python",
"google-app-engine",
"gae-datastore"
] |
Formatted text in GAE | 640,733 | <p>Google app engine question: What is a good way to take formatted text (does not have to be rich text) from the user and then store it in a text or blog property in the datastore? Mainly what I'm looking for is it to store newlines and strings of spaces, so that the text comes back looking the same as when it was sub... | 3 | 2009-03-12T22:22:32Z | 641,790 | <p>Other commonly used <em>simplified markups</em> include <a href="http://pypi.python.org/pypi/textile" rel="nofollow">Textile</a> and <a href="http://pypi.python.org/pypi/Markdown" rel="nofollow">Markdown</a>.</p>
| 2 | 2009-03-13T08:00:57Z | [
"python",
"google-app-engine",
"gae-datastore"
] |
Writing to the serial port in Vista from Python | 640,802 | <p>How do I write to the serial port in Vista from Python? The termios package only seem to support posix.</p>
| 5 | 2009-03-12T22:49:56Z | 640,832 | <p><a href="http://pyserial.wiki.sourceforge.net/pySerial">pyserial</a> does the trick, you'll need <a href="http://sourceforge.net/projects/pywin32/">python extensions for windows</a> for it to work in windows.</p>
| 9 | 2009-03-12T23:02:11Z | [
"python",
"windows"
] |
Writing to the serial port in Vista from Python | 640,802 | <p>How do I write to the serial port in Vista from Python? The termios package only seem to support posix.</p>
| 5 | 2009-03-12T22:49:56Z | 641,193 | <p>Seems like it wasn't any harder than this using <a href="http://pyserial.wiki.sourceforge.net/pySerial">pyserial</a>: </p>
<pre><code>import serial
ser = serial.Serial(0) # open first serial port with 9600,8,N,1
print ser.portstr # check which port was really used
ser.write('hello')
ser.close()
</code></pre... | 7 | 2009-03-13T01:47:42Z | [
"python",
"windows"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 640,964 | <p>TG2 takes Pylons and changes some defaults - object dispatching instead of Routes, and Genshi instead of Mako. They believe <a href="http://wiki.python.org/moin/TOOWTDI" rel="nofollow">there's only one way to do it</a>, so apps can rely on the same API for any TurboGears website.</p>
<h2>Similarities</h2>
<ul>
<l... | 14 | 2009-03-13T00:06:44Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 641,033 | <p>Besides what Nikhil gave in his answer, I think another minor difference is that Turbogears provdes some support for javascript widgets and integration with <a href="http://mochikit.com/" rel="nofollow">Mochikit</a>.</p>
<p>Whereas Django steadfastly remains javascript framework neutral.</p>
<p>(At least this was ... | 1 | 2009-03-13T00:33:17Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 641,046 | <p>Because Django uses its own ORM it limits you to learn that ORM for that specific web framework. I think using an web framework with a more popular ORM (like SqlAlchemy which TG uses) increases your employability chances. Just my 2 cents ..</p>
| 0 | 2009-03-13T00:37:04Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 641,232 | <p>One of the most important questions is not just what technical features this platform provides or that platform provides, but the driving philosophy of the open source project and the nature of the community supporting it. </p>
<p>I've got no dog in this fight myself, but I found <a href="http://www.youtube.com/wa... | 1 | 2009-03-13T02:16:20Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 642,874 | <p>Last I checked, django has a very poor data implementation. And that's a huge weakness in my book. Django's orm doesn't allow me to use the power of the underlying database. For example I can't use compound primary keys, which are important to good db design. It also doesn't support more than a single database, ... | 0 | 2009-03-13T14:06:02Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 703,311 | <p>TG2 has several advantages that I think are important: </p>
<ul>
<li>Multi-database support</li>
<li>sharding/data partitioning support</li>
<li>longstanding support for aggregates, multi-column primary keys</li>
<li>a transaction system that handles multi-database transactions for you</li>
<li>an admin system that... | 15 | 2009-03-31T22:21:15Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 1,387,123 | <p>Pros.</p>
<ul>
<li>SQLAlchemy > django ORM</li>
<li>Multiple template languages out of the box (genshi,mako,jinja2)</li>
<li>more WSGI friendly</li>
<li>Object Dispatch > routes > regexp routing. You can get the first 2 with TG2</li>
<li>Almost all components are optional you can keep the core and use any ORM, temp... | 5 | 2009-09-07T00:40:33Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Can anyone point out the pros and cons of TG2 over Django? | 640,877 | <p>Django is my favorite python web framework. I've tried out others like pylons, web2py, nevow and others.</p>
<p>But I've never looked into TurboGears with much enthusiasm.</p>
<p>Now with TG2 out of beta I may give it a try. I'd like to know what are some of the pros and cons compared to Django.</p>
| 8 | 2009-03-12T23:26:35Z | 1,518,126 | <p>I was struggling with the same question months ago and decided for <strong>Turbogears 2</strong>, and my reasoning was simple. "<em>I'm new to python, I want to learn it not just for web-projects but as a substitute to php for scripting small helpers</em>"</p>
<p>What I didn't like about Django, to me looks like a ... | 2 | 2009-10-05T03:10:41Z | [
"python",
"django",
"turbogears",
"turbogears2"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 641,004 | <p><strong>Generally:</strong></p>
<p>1) Set up a dedicated email account for the purpose.</p>
<p>2) Have a programm monitor the mailbox (let's say fetchmail, since that's what I do).</p>
<p>3) When an email arrives at the account, fetchmail downloads the email, writes it to disk, and calls script or program you hav... | 7 | 2009-03-13T00:20:12Z | [
"python",
"django",
"email",
"email-integration"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 641,020 | <p>A common tool used for this purpose is <a href="http://en.wikipedia.org/wiki/Procmail" rel="nofollow">procmail</a>.</p>
<p>You need to set up dedicated email address (which is the "from_email" address in your outgoing email). Then your MTA, such as postfix or qmail, will deliver mail to that address to procmail ins... | 1 | 2009-03-13T00:27:36Z | [
"python",
"django",
"email",
"email-integration"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 641,038 | <p>To see a working example on how to receive emails in python and process then using django, check this: <a href="http://code.google.com/p/jutda-helpdesk/" rel="nofollow">http://code.google.com/p/jutda-helpdesk/</a></p>
| 1 | 2009-03-13T00:34:48Z | [
"python",
"django",
"email",
"email-integration"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 641,062 | <p>From your tags, I'll assume you're wanting to do this in Django.</p>
<p>There's an app out there called <a href="http://code.google.com/p/jutda-helpdesk/" rel="nofollow">jutda-helpdesk</a> that does exactly what you're looking for using poplib, which means you just have to set up a POP3 compatible email address.</p... | 4 | 2009-03-13T00:41:04Z | [
"python",
"django",
"email",
"email-integration"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 641,837 | <p>This is an area where the Rails-world is ahead: <a href="http://guides.rubyonrails.org/action%5Fmailer%5Fbasics.html#receiving-emails" rel="nofollow">Rails has built-in support for receiving emails</a>. The mail sever configuration though is probably just the same.</p>
| 3 | 2009-03-13T08:36:14Z | [
"python",
"django",
"email",
"email-integration"
] |
Email integration | 640,970 | <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your response.</p>
<p>M... | 12 | 2009-03-13T00:09:14Z | 1,337,275 | <p>You should take a look at <a href="http://lamsonproject.org">Lamson</a>; it'll enable you do what you've described, and more besides.</p>
| 5 | 2009-08-26T20:27:59Z | [
"python",
"django",
"email",
"email-integration"
] |
Unable to set iPython to use 2.6.1 Python | 641,000 | <p>I have installed the newest iPython in Mac. However, it uses the Python verion 2.5.1.</p>
<p>I installed the Python 2.6.1 by MacPython package at <a href="http://www.python.org/download/" rel="nofollow">here</a>. </p>
<p><strong>How can I make my iPython to use Python 2.6.1?</strong></p>
<p>I am not sure where th... | 1 | 2009-03-13T00:19:37Z | 641,367 | <p>you should have a python, python2.5 and python2.6, is that correct? If you wan't to use python2.6 system wide the symple solution would be to sym link (ln -s ..) python to python2.6 instead of python2.5</p>
| 1 | 2009-03-13T03:25:37Z | [
"python",
"ipython"
] |
Unable to set iPython to use 2.6.1 Python | 641,000 | <p>I have installed the newest iPython in Mac. However, it uses the Python verion 2.5.1.</p>
<p>I installed the Python 2.6.1 by MacPython package at <a href="http://www.python.org/download/" rel="nofollow">here</a>. </p>
<p><strong>How can I make my iPython to use Python 2.6.1?</strong></p>
<p>I am not sure where th... | 1 | 2009-03-13T00:19:37Z | 2,422,942 | <p>A good way to get it to work is <a href="http://www.jamesmurty.com/2009/06/05/ipython-with-python-2_6-osx-leopard/" rel="nofollow">here.</a> I needed to restart my terminal before ipython pointed to python2.6. Note the latest ipython distribution is 0.10, not 0.9.</p>
| 4 | 2010-03-11T06:08:52Z | [
"python",
"ipython"
] |
Django, Python Loop Logic Problem | 641,145 | <p>This works, partially. More information may be needed, however, I thought I would post to get advice on anything obvious that might be wrong here.</p>
<p>The problem is that if activity.get_cost() returns a <code>False</code> value, the function seems to exit entirely, returning <code>None</code>.</p>
<p>What I'd... | 1 | 2009-03-13T01:21:36Z | 641,157 | <p>I think you can simplify this with:</p>
<pre><code>def get_jobrecord_cost(self):
costs = 0
for activity in self.activity_set.all():
cost = activity.get_cost()
if cost:
costs += cost
return costs
</code></pre>
| 2 | 2009-03-13T01:26:41Z | [
"python",
"django-models"
] |
Django, Python Loop Logic Problem | 641,145 | <p>This works, partially. More information may be needed, however, I thought I would post to get advice on anything obvious that might be wrong here.</p>
<p>The problem is that if activity.get_cost() returns a <code>False</code> value, the function seems to exit entirely, returning <code>None</code>.</p>
<p>What I'd... | 1 | 2009-03-13T01:21:36Z | 641,178 | <p>I notice you're returning False if all the costs were None; I don't know if there's a specific reason for that, but it does make it a little bit harder to write. If that's not a requirement, you could write it like this:</p>
<pre><code>def get_jobrecord_cost(self):
costs = [activity.get_cost() or 0 for activit... | 3 | 2009-03-13T01:39:07Z | [
"python",
"django-models"
] |
Django, Python Loop Logic Problem | 641,145 | <p>This works, partially. More information may be needed, however, I thought I would post to get advice on anything obvious that might be wrong here.</p>
<p>The problem is that if activity.get_cost() returns a <code>False</code> value, the function seems to exit entirely, returning <code>None</code>.</p>
<p>What I'd... | 1 | 2009-03-13T01:21:36Z | 641,187 | <pre><code>def get_jobrecord_cost(self):
return sum((activity.get_cost() or 0 for activity in activity_set.all()) or 0)
</code></pre>
<p>Depending on how much data you're dealing with, this version is just a bit more efficient than DNS's because it uses a generator comprehension and doesn't require loading up a wh... | 1 | 2009-03-13T01:43:49Z | [
"python",
"django-models"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 641,488 | <p>The only way to deal with this non-intrusively is to:</p>
<ol>
<li>Spawn each worker process such that its log goes to <strong>a different file descriptor</strong> (to disk or to pipe.) Ideally, all log entries should be timestamped. </li>
<li>Your controller process can then do <em>one</em> of the following:
<ul... | 40 | 2009-03-13T04:39:42Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 641,489 | <p>just publish somewhere your instance of the logger. that way, the other modules and clients can use your API to get the logger without having to <code>import multiprocessing</code>.</p>
| 3 | 2009-03-13T04:40:00Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 641,490 | <p>One of the alternatives is to write the mutliprocessing logging to a known file and register an <code>atexit</code> handler to join on those processes read it back on stderr; however, you won't get a real-time flow to the output messages on stderr that way.</p>
| 0 | 2009-03-13T04:40:17Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 642,221 | <p>Yet another alternative might be the various non-file-based logging handlers in the <a href="http://docs.python.org/library/logging.html" rel="nofollow"><code>logging</code> package</a>: </p>
<ul>
<li><code>SocketHandler</code></li>
<li><code>DatagramHandler</code></li>
<li><code>SyslogHandler</code></li>
</ul>
<p... | 16 | 2009-03-13T11:19:29Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 894,284 | <p>I just now wrote a log handler of my own that just feeds everything to the parent process via a pipe. I've only been testing it for ten minutes but it seems to work pretty well. </p>
<p>(<strong>Note:</strong> This is hardcoded to <code>RotatingFileHandler</code>, which is my own use case.)</p>
<hr>
<h2>Update: ... | 65 | 2009-05-21T18:10:33Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 959,727 | <p>I liked zzzeek's answer. I would just substitute the Pipe for a Queue since if multiple threads/processes use the same pipe end to generate log messages they will get garbled.</p>
| 3 | 2009-06-06T13:59:52Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 1,009,560 | <p>I also like zzzeek's answer but Andre is correct that a queue is required to prevent garbling. I had some luck with the pipe, but did see garbling which is somewhat expected. Implementing it turned out to be harder than I thought, particularly due to running on Windows, where there are some additional restrictions a... | 6 | 2009-06-17T21:15:15Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 3,253,442 | <p>A variant of the others that keeps the logging and queue thread separate.</p>
<pre><code>"""sample code for logging in subprocesses using multiprocessing
* Little handler magic - The main process uses loggers and handlers as normal.
* Only a simple handler is needed in the subprocess that feeds the queue.
* Origin... | 11 | 2010-07-15T07:41:56Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 3,412,173 | <p>I have a solution that's similar to ironhacker's except that I use logging.exception in some of my code and found that I needed to format the exception before passing it back over the Queue since tracebacks aren't pickle'able:</p>
<pre><code>class QueueHandler(logging.Handler):
def __init__(self, queue):
... | 1 | 2010-08-05T06:11:37Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 19,397,561 | <p>All current solutions are too coupled to the logging configuration by using a handler. My solution has the following architecture and features:</p>
<ul>
<li>You can use <em>any</em> logging configuration you want </li>
<li>Logging is done in a daemon thread</li>
<li>Safe shutdown of the daemon by using a context ma... | 9 | 2013-10-16T07:31:34Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 22,365,834 | <p>How about delegating all the logging to another process that reads all log entries from a Queue?</p>
<pre><code>LOG_QUEUE = multiprocessing.JoinableQueue()
class CentralLogger(multiprocessing.Process):
def __init__(self, queue):
multiprocessing.Process.__init__(self)
self.queue = queue
... | 2 | 2014-03-12T23:13:44Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 29,277,969 | <p>If you have deadlocks occurring in a combination of locks, threads and forks in the <code>logging</code> module, that is reported in <a href="http://bugs.python.org/issue6721" rel="nofollow">bug report 6721</a> (see also <a href="http://stackoverflow.com/questions/24509650">related SO question</a>).</p>
<p>There is... | 0 | 2015-03-26T12:04:40Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 32,065,395 | <p>The python logging cookbook has two complete examples here: <a href="https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes" rel="nofollow">https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes</a></p>
<p>It uses <code>... | 4 | 2015-08-18T06:47:17Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 34,964,369 | <p>Below is another solution with a focus on simplicity for anyone else (like me) who get here from Google. Logging should be easy! Only for 3.2 or higher.</p>
<pre><code>import multiprocessing
import logging
from logging.handlers import QueueHandler, QueueListener
import time
import random
def f(i):
time.slee... | 2 | 2016-01-23T13:59:47Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 37,561,518 | <p>Below is a class that can be used in Windows environment, requires ActivePython.
You can also inherit for other logging handlers (StreamHandler etc.)</p>
<pre><code>class SyncronizedFileHandler(logging.FileHandler):
MUTEX_NAME = 'logging_mutex'
def __init__(self , *args , **kwargs):
self.mutex = w... | 1 | 2016-06-01T06:57:48Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 39,355,401 | <p>Not really a full answer, but to chip in my 2 cents I think for people browsing this thread it would be very useful to know that QueueHandler, QueueListener are made compatible with Python 2.7 through logutils module. </p>
| 0 | 2016-09-06T18:16:11Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 39,475,286 | <p>Here's my simple hack/workaround... not the most comprehensive, but easily modifiable and simpler to read and understand I think than any other answers I found before writing this:</p>
<pre><code>import logging
import multiprocessing
class FakeLogger(object):
def __init__(self, q):
self.q = q
def i... | 0 | 2016-09-13T16:55:19Z | [
"python",
"logging",
"multiprocessing"
] |
How should I log while using multiprocessing in Python? | 641,420 | <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiprocessing</code>, there is module-level multiprocessing-aware... | 123 | 2009-03-13T04:02:31Z | 40,126,988 | <p>Since we can represent multiprocess logging as many publishers and one subscriber (listener), using <a href="http://zguide.zeromq.org/page:all" rel="nofollow">ZeroMQ</a> to implement PUB-SUB messaging is indeed an option. </p>
<p>Moreover, <a href="http://pyzmq.readthedocs.io" rel="nofollow">PyZMQ</a> module, is th... | 0 | 2016-10-19T09:11:43Z | [
"python",
"logging",
"multiprocessing"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 641,485 | <pre><code>dispatch = {
'check': do_check,
'search': do_search,
}
cmd, _, arg = input.partition(' ')
if cmd in dispatch:
dispatch[cmd](arg)
else:
do_default(cmd, arg)
</code></pre>
| 31 | 2009-03-13T04:37:58Z | [
"conditional",
"python"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 641,546 | <p>If you're looking for a one liner 'pythonic' approach to this you can use this:</p>
<pre><code>
def do_check(x): print 'checking for:', x
def do_search(x): print 'searching for:', x
input = 'check yahoo.com'
{'check': do_check}.get(input.split()[0], do_search)(input.split()[1])
# checking for: yahoo.com
input = '... | 0 | 2009-03-13T05:11:16Z | [
"conditional",
"python"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 641,607 | <p>This lets you avoid giving each command name twice; function names are used almost directly as command names.</p>
<pre><code>class CommandFunctions:
def c_check(self, arg):
print "checking", arg
def c_search(self, arg):
print "searching for", arg
def c_compare(self, arg1, arg2):
... | 3 | 2009-03-13T05:50:13Z | [
"conditional",
"python"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 642,037 | <blockquote>
<p>I am fairly sure there's a much better way to do these things... some way more pythonic.</p>
</blockquote>
<p>Not really. You code is simple, clear, obvious and English-like.</p>
<blockquote>
<p>I've seen some examples of people replacing switch statements with dicts and lambda functions,</p>
</b... | 4 | 2009-03-13T10:08:02Z | [
"conditional",
"python"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 649,034 | <p>Disregard, I just realized that my answer was similar to one of the other answers - and apparently there's no delete key :)</p>
| 0 | 2009-03-16T02:06:21Z | [
"conditional",
"python"
] |
"Pythonic" equivalent for handling switch and multiple string compares | 641,469 | <p>Alright, so my title sucked. An example works better:</p>
<pre><code>input = 'check yahoo.com'
</code></pre>
<p>I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:</p>
<pre><code>if len(input... | 8 | 2009-03-13T04:31:55Z | 991,052 | <p>Variation on <a href="http://stackoverflow.com/questions/641469/pythonic-equivalent-for-handling-switch-and-multiple-string-compares/641485#641485">@MizardX's answer</a>:</p>
<pre><code>from collections import defaultdict
dispatch = defaultdict(do_default, check=do_check, search=do_search)
cmd, _, arg = input.part... | 0 | 2009-06-13T17:05:03Z | [
"conditional",
"python"
] |
Can 3D OpenGL game written in Python look good and run fast? | 641,770 | <p>I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). </p>
<p>When I was planning what to do, I started wondering about switching to Python. I know that Pytho... | 12 | 2009-03-13T07:48:58Z | 641,832 | <p>If you are worried about 3D performance: Most of the performance-critical parts will be handled by OpenGL (in a C library or even in hardware), so the language you use to drive it should not matter too much.</p>
<p>To really find out if performance is a problem, you'd have to try it. But there is no reason why it c... | 17 | 2009-03-13T08:31:34Z | [
"python",
"opengl"
] |
Can 3D OpenGL game written in Python look good and run fast? | 641,770 | <p>I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). </p>
<p>When I was planning what to do, I started wondering about switching to Python. I know that Pytho... | 12 | 2009-03-13T07:48:58Z | 641,838 | <p>You might want to check out <a href="http://www.python-ogre.org/" rel="nofollow">Python-Ogre</a>. I just messed with it myself, nothing serious, but seems pretty good. </p>
| 2 | 2009-03-13T08:36:47Z | [
"python",
"opengl"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.