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
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
636,570
<p><a href="http://docs.python.org/library/subprocess.html">subprocess.Popen</a> does exactly what you want.</p> <pre><code>from subprocess import Popen p = Popen(['watch', 'ls']) # something long running # ... do other stuff while subprocess is running p.terminate() </code></pre> <p>(Edit to complete the answer from...
72
2009-03-11T22:05:32Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
636,601
<p>If you want to run many processes in parallel and then handle them when they yield results, you can use polling like in the following:</p> <pre><code>from subprocess import Popen, PIPE import time running_procs = [ Popen(['/usr/bin/my_cmd', '-i %s' % path], stdout=PIPE, stderr=PIPE) for path in '/tmp/file0...
33
2009-03-11T22:15:50Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
636,620
<p><strong>What I am wondering is if this [os.system()] is the proper way to accomplish such a thing?</strong></p> <p>No. <code>os.system()</code> is not the proper way. That's why everyone says to use <code>subprocess</code>. </p> <p>For more information, read <a href="http://docs.python.org/library/os.html#os.sy...
7
2009-03-11T22:24:32Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
636,719
<p>I've had good success with the <a href="http://www.lysator.liu.se/~bellman/download/asyncproc.py" rel="nofollow">asyncproc</a> module, which deals nicely with the output from the processes. For example:</p> <pre><code>import os from asynproc import Process myProc = Process("myprogram.app") while True: # check ...
5
2009-03-11T23:04:44Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
959,402
<p>I have the same problem trying to connect to an 3270 terminal using the s3270 scripting software in Python. Now I'm solving the problem with an subclass of Process that I found here:</p> <p><a href="http://code.activestate.com/recipes/440554/" rel="nofollow">http://code.activestate.com/recipes/440554/</a></p> <p>A...
2
2009-06-06T10:07:22Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
How can I run an external command asynchronously from Python?
636,561
<p>I need to run a shell command asynchronously from a Python script. By this I mean that I want my Python script to continue running while the external command goes off and does whatever it needs to do.</p> <p>I read this post: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/89228/how-to-call-exte...
60
2009-03-11T22:01:42Z
3,187,136
<p>Using pexpect [ <a href="http://www.noah.org/wiki/Pexpect">http://www.noah.org/wiki/Pexpect</a> ] with non-blocking readlines is another way to do this. Pexpect solves the deadlock problems, allows you to easily run the processes in the background, and gives easy ways to have callbacks when your process spits out p...
5
2010-07-06T14:30:28Z
[ "python", "asynchronous", "subprocess", "scheduler" ]
Python Profiling in Eclipse
636,695
<p>This questions is semi-based of this one here:</p> <p><a href="http://stackoverflow.com/questions/582336/how-can-you-profile-a-python-script">http://stackoverflow.com/questions/582336/how-can-you-profile-a-python-script</a></p> <p>I thought that this would be a great idea to run on some of my programs. Although pr...
11
2009-03-11T22:55:47Z
636,773
<p>You can always make separate modules that do just profiling specific stuff in your other modules. You can organize modules like these in a separate package. That way you don't change your existing code.</p>
0
2009-03-11T23:31:22Z
[ "python", "eclipse", "profiling" ]
Python Profiling in Eclipse
636,695
<p>This questions is semi-based of this one here:</p> <p><a href="http://stackoverflow.com/questions/582336/how-can-you-profile-a-python-script">http://stackoverflow.com/questions/582336/how-can-you-profile-a-python-script</a></p> <p>I thought that this would be a great idea to run on some of my programs. Although pr...
11
2009-03-11T22:55:47Z
637,561
<p>if you follow the common python idiom to make all your code, even the "existing programs", importable as modules, you could do exactly what you describe, without any additional hassle.</p> <p>here is the specific idiom I am talking about, which turns your program's flow "upside-down" since the <code>__name__ == '__...
4
2009-03-12T06:22:20Z
[ "python", "eclipse", "profiling" ]
Unable to make each sentence to start at a new line in LaTex by AWK/Python
636,887
<p>I have a long document in LaTex, which contains paragraphs. The paragraphs contain sentences such that no subsequent sentence start at a new line.</p> <p><strong>How can you make each subsequent sentence to start at a new line in my .tex file?</strong></p> <p><em>My attempt to the problem</em></p> <p>We need to p...
1
2009-03-12T00:14:08Z
636,955
<p>So you want every sentence in your .tex file to start on a new line, but without introducing extra paragraphs? Is that correct?</p> <p>Possibly you could go through your file and, every time you see a '.' followed by whitespace and a capital letter, insert a newline.</p> <p>e.g. in python:</p> <pre><code>import ...
2
2009-03-12T00:36:40Z
[ "python", "latex", "awk" ]
Unable to make each sentence to start at a new line in LaTex by AWK/Python
636,887
<p>I have a long document in LaTex, which contains paragraphs. The paragraphs contain sentences such that no subsequent sentence start at a new line.</p> <p><strong>How can you make each subsequent sentence to start at a new line in my .tex file?</strong></p> <p><em>My attempt to the problem</em></p> <p>We need to p...
1
2009-03-12T00:14:08Z
636,960
<p>What's wrong with putting a newline after each period? Eg:</p> <pre><code>awk '{ gsub(/\. +/, ".\n"); print }' $ echo "abc. 123. xyz." | awk '{ gsub(/\. +/, ".\n"); print }' abc. 123. xyz. </code></pre>
2
2009-03-12T00:38:46Z
[ "python", "latex", "awk" ]
Unable to make each sentence to start at a new line in LaTex by AWK/Python
636,887
<p>I have a long document in LaTex, which contains paragraphs. The paragraphs contain sentences such that no subsequent sentence start at a new line.</p> <p><strong>How can you make each subsequent sentence to start at a new line in my .tex file?</strong></p> <p><em>My attempt to the problem</em></p> <p>We need to p...
1
2009-03-12T00:14:08Z
636,981
<p>If I read your question correctly, what you need is the <code>\newline</code> command. Put it after each sentence. <code>\\</code> is a shortcut for this.</p> <p>A regex to do this would be something like</p> <pre><code>s/\. ([A-Z])/.\\newline\1/ </code></pre>
2
2009-03-12T00:49:58Z
[ "python", "latex", "awk" ]
Django form - set label
636,905
<p>I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?</p> <p>I'm trying to do it in my <code>__init__</code>, but it throws an error saying that "'RegistrationFormTOS' object has no attri...
42
2009-03-12T00:18:35Z
637,019
<p>You access fields in a form via the 'fields' dict:</p> <pre><code>self.fields['email'].label = "New Email Label" </code></pre> <p>That's so that you don't have to worry about form fields having name clashes with the form class methods. (Otherwise you couldn't have a field named 'clean' or 'is_valid') Defining th...
6
2009-03-12T01:06:37Z
[ "python", "django", "inheritance", "django-forms" ]
Django form - set label
636,905
<p>I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?</p> <p>I'm trying to do it in my <code>__init__</code>, but it throws an error saying that "'RegistrationFormTOS' object has no attri...
42
2009-03-12T00:18:35Z
637,020
<p>You should use:</p> <pre><code>def __init__(self, *args, **kwargs): super(RegistrationFormTOS, self).__init__(*args, **kwargs) self.fields['email'].label = "New Email Label" </code></pre> <p>Note first you should use the super call.</p>
86
2009-03-12T01:06:40Z
[ "python", "django", "inheritance", "django-forms" ]
Django form - set label
636,905
<p>I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?</p> <p>I'm trying to do it in my <code>__init__</code>, but it throws an error saying that "'RegistrationFormTOS' object has no attri...
42
2009-03-12T00:18:35Z
5,677,126
<p>It don't work for model inheritance, but you can set the label directly in the model</p> <pre><code>email = models.EmailField("E-Mail Address") email_confirmation = models.EmailField("Please repeat") </code></pre>
0
2011-04-15T13:00:13Z
[ "python", "django", "inheritance", "django-forms" ]
Django form - set label
636,905
<p>I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?</p> <p>I'm trying to do it in my <code>__init__</code>, but it throws an error saying that "'RegistrationFormTOS' object has no attri...
42
2009-03-12T00:18:35Z
19,262,996
<p>You can set <code>label</code> as an attribute of field when you define form.</p> <pre><code>class GiftCardForm(forms.ModelForm): card_name = forms.CharField(max_length=100, label="Cardholder Name") card_number = forms.CharField(max_length=50, label="Card Number") card_code = forms.CharField(max_length=...
0
2013-10-09T04:14:27Z
[ "python", "django", "inheritance", "django-forms" ]
Django form - set label
636,905
<p>I have a form that inherits from 2 other forms. In my form, I want to change the label of a field that was defined in one of the parent forms. Does anyone know how this can be done?</p> <p>I'm trying to do it in my <code>__init__</code>, but it throws an error saying that "'RegistrationFormTOS' object has no attri...
42
2009-03-12T00:18:35Z
28,162,469
<p>Here's an example taken from <a href="https://docs.djangoproject.com/en/1.10/topics/forms/modelforms/#overriding-the-default-fields" rel="nofollow">Overriding the default fields</a>:</p> <blockquote> <pre><code>from django.utils.translation import ugettext_lazy as _ class AuthorForm(ModelForm): class Meta: ...
10
2015-01-27T02:54:37Z
[ "python", "django", "inheritance", "django-forms" ]
Best way to remove duplicate characters (words) in a string?
636,977
<p>What would be the best way of removing any duplicate characters and sets of characters separated by spaces in string?</p> <p>I think this example explains it better:</p> <pre><code>foo = 'h k k h2 h' </code></pre> <p>should become: </p> <pre><code>foo = 'h k h2' # order not important </code></pre> <p>Other exam...
0
2009-03-12T00:48:24Z
636,982
<p>Do you mean?</p> <pre><code>' '.join( set( someString.split() ) ) </code></pre> <p>That's the unique space-delimited words in no particular order.</p>
8
2009-03-12T00:49:59Z
[ "python", "string", "duplicates" ]
Best way to remove duplicate characters (words) in a string?
636,977
<p>What would be the best way of removing any duplicate characters and sets of characters separated by spaces in string?</p> <p>I think this example explains it better:</p> <pre><code>foo = 'h k k h2 h' </code></pre> <p>should become: </p> <pre><code>foo = 'h k h2' # order not important </code></pre> <p>Other exam...
0
2009-03-12T00:48:24Z
636,996
<pre><code>out = [] for word in input.split(): if not word in out: out.append(word) output_string = " ".join(out) </code></pre> <p>Longer than using a set, but it keeps the order.</p> <p><strong>Edit:</strong> Nevermind. I missed the part in the question about order not being important. Using a set is b...
5
2009-03-12T00:57:24Z
[ "python", "string", "duplicates" ]
Best way to remove duplicate characters (words) in a string?
636,977
<p>What would be the best way of removing any duplicate characters and sets of characters separated by spaces in string?</p> <p>I think this example explains it better:</p> <pre><code>foo = 'h k k h2 h' </code></pre> <p>should become: </p> <pre><code>foo = 'h k h2' # order not important </code></pre> <p>Other exam...
0
2009-03-12T00:48:24Z
636,997
<pre><code>' '.join(set(foo.split())) </code></pre> <p>Note that split() by default will split on all whitespace characters. (e.g. tabs, newlines, spaces)</p> <p>So if you want to split ONLY on a space then you have to use:</p> <pre><code>' '.join(set(foo.split(' '))) </code></pre>
10
2009-03-12T00:58:06Z
[ "python", "string", "duplicates" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
637,004
<p>I'd say pygame -- I've heard it's lots of fun, easy and happy. Also, all of my experiences with wxPython have been sad an painful.</p> <p>But I'm not bias or anything.</p>
1
2009-03-12T01:00:17Z
[ "python", "wxpython", "pygame", "playing-cards" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
637,017
<p>If all you want is a GUI, wxPython should do the trick.</p> <p>If you're looking to add sound, controller input, and take it beyond a simple card game, then you may want to use pygame.</p>
6
2009-03-12T01:06:26Z
[ "python", "wxpython", "pygame", "playing-cards" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
637,864
<p>I haven't used wxPython, but Pygame by itself is rather low-level. It allows you to catch key presses, mouse events and draw stuff on the screen, but doesn't offer any pre-made GUI controls. If you use Pygame, you will either have to write your own GUI classes or use existing GUI extensions for Pygame, like <a href=...
4
2009-03-12T09:30:17Z
[ "python", "wxpython", "pygame", "playing-cards" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
638,393
<p>The answers to this related question may be very useful for you:</p> <p><a href="http://stackoverflow.com/questions/343505/what-can-pygame-do-in-terms-of-graphics-that-wxpython-cant">What can Pygame do in terms of graphics that wxPython can't?</a></p>
2
2009-03-12T12:26:51Z
[ "python", "wxpython", "pygame", "playing-cards" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
640,064
<p>Generally, PyGame is the better option for coding games. But that's for the more common type of games - where things move on the screen and you must have a good "frame-rate" performance. </p> <p>For something like a card game, however, I'd go with wxPython (or rather, PyQt). This is because a card game hasn't much ...
2
2009-03-12T19:09:36Z
[ "python", "wxpython", "pygame", "playing-cards" ]
wxPython or pygame for a simple card game?
636,990
<p>I have been playing around with writing some simple card games in Python for fun and I would like to add a graphical user interface (GUI) to the games. Which library would you recommend for writing the GUI for a simple card game?</p>
6
2009-03-12T00:53:27Z
3,550,215
<p>pygame is the typical choice, but pyglet has been getting a lot of attention at PyCon. Here's a wiki entry on Python Game libraries: <a href="http://wiki.python.org/moin/PythonGameLibraries" rel="nofollow">http://wiki.python.org/moin/PythonGameLibraries</a></p>
1
2010-08-23T17:49:38Z
[ "python", "wxpython", "pygame", "playing-cards" ]
Django: Uploaded file locked. Can't rename
637,160
<p>I'm trying to rename a file after it's uploaded in the model's save method. I'm renaming the file to a combination the files primary key and a slug of the file title.</p> <p>I have it working when a file is first uploaded, when a new file is uploaded, and when there are no changes to the file or file title.</p> <p...
3
2009-03-12T02:14:52Z
637,169
<p>I think you should look more closely at the upload_to field. This would probably be simpler than messing around with renaming during save.</p> <p><a href="http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield" rel="nofollow">http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield</a></p> <bl...
5
2009-03-12T02:21:00Z
[ "python", "django", "file-io" ]
Django: Uploaded file locked. Can't rename
637,160
<p>I'm trying to rename a file after it's uploaded in the model's save method. I'm renaming the file to a combination the files primary key and a slug of the file title.</p> <p>I have it working when a file is first uploaded, when a new file is uploaded, and when there are no changes to the file or file title.</p> <p...
3
2009-03-12T02:14:52Z
643,588
<p>Once uploaded, all you have is an image object in memory, right?</p> <p>You could save this object yourself in the folder of your choice, and then edit the database entry by hand.</p> <p>You'd be bypassing the whole Django ORM, and is not something I'd do unlessI couldn't find a more Django way.</p>
0
2009-03-13T16:40:01Z
[ "python", "django", "file-io" ]
Django: Uploaded file locked. Can't rename
637,160
<p>I'm trying to rename a file after it's uploaded in the model's save method. I'm renaming the file to a combination the files primary key and a slug of the file title.</p> <p>I have it working when a file is first uploaded, when a new file is uploaded, and when there are no changes to the file or file title.</p> <p...
3
2009-03-12T02:14:52Z
643,789
<p>My other answer is deprecated, use this instead:</p> <pre><code>class File(models.Model): nzb = models.FileField(upload_to=get_filename) ... def get_filename(instance, filename): if not instance.pk: instance.save() # Create the name slug. name_slug = re.sub('[^a-zA-Z0...
3
2009-03-13T17:32:37Z
[ "python", "django", "file-io" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,309
<p>It can be confusing in some editors where one line is indented with spaces and the next is indented with a tab. This is confusing as the indentation looks the same but causes an error.</p> <p>Also when your copying code, if your editor doesn't have a function to indent entire blocks, it could be annoying fixing all...
11
2009-03-12T03:59:08Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,310
<p>The problem is that in Python, if you use spaces to indent basic blocks in one area of a file, and tabs to indent in another, you get a run-time error. This is quite different from semicolons in C.</p> <p>This isn't really a programming question, though, is it?</p>
0
2009-03-12T03:59:39Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,331
<p>That actually kept me away from Python for a while. Coming from a strong C background, I felt like I was driving without a seat belt.</p> <p>It was aggravating when I was trying to fill up a snippet library in my editor with boilerplate, frequently used classes. I learn best by example, so I was grabbing as many in...
2
2009-03-12T04:11:21Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,341
<p>Whitespace block delimiters force a certain amount of code formatting, which seems to irritate some programmers. Some in our shop seem to be of the attitude that they are too busy, or can't be bothered to pay attention to formatting standards, and a language that forces it rubs them raw. Sometimes the same folks gri...
1
2009-03-12T04:18:40Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,342
<p>Long ago, in and environment far, far away, there were languages (such as RPG) that depended on the column structure of punch cards. This was a tedious and annoying system, and led to many errors, and newer languages such as BASIC, pascal, and so forth were designed without this dependency.</p> <p>A generation of ...
1
2009-03-12T04:18:46Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,344
<p>Some people say that they don't like python indentation, because it can cause errors, which would be immensely hard to detect in case if tabs and spaces are mixed. For example: </p> <pre><code>1 if needFrobnicating: 2 frobnicate() 3 update() </code></pre> <p>Depending on the tab width, line 3 may appear to be i...
1
2009-03-12T04:20:47Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,361
<p>The only trouble I've ever had is minor annoyances when I'm using code I wrote before I settled on whether I liked tabs or spaces, or cutting and posting code from a website.</p> <p>I think most decent editors these days have a convert tabs-to-spaces and back option. Textmate certainly does.</p> <p>Beyond that, t...
0
2009-03-12T04:27:56Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,375
<p>When python programmers don't follow the common convention of "Use 4 spaces per indentation level" defined in <a href="http://www.python.org/dev/peps/pep-0008/" rel="nofollow"><strong>PEP 8</strong></a>. (<em>If your a python programmer and haven't read it please do so</em>)</p> <p>Then you run into copy paste issu...
1
2009-03-12T04:33:26Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,388
<p>Pick a good editor. You'd want features such as:</p> <ol> <li>Automatic indentation that mimics the last indented line</li> <li>Automatic indentation that you can control (tabs vs. spaces)</li> <li>Show whitespace characters</li> <li>Detection and mimicking of whitespace convention when loading a file</li> </ol> <...
1
2009-03-12T04:37:09Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,404
<p>I used to think that the white space issues was just a question of getting used to it.</p> <p>Someone pointed out some serious flaws with Python indentation and I think they are quite valid and some subconcious understanding of these is what makes experienced programs nervious about the whole thing:-</p> <ul> <li>...
0
2009-03-12T04:48:18Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
637,423
<p>yeah there are some pitfalls, but most of the time, in practice, they turn out to be enemy <a href="http://en.wikipedia.org/wiki/Tilting%5Fat%5Fwindmills">windmills of the Quixotic style</a>, i.e. imaginary, and nothing to worry about in reality. </p> <p>I would estimate that the pitfalls one is <em>most likely to...
10
2009-03-12T04:56:58Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
638,131
<p>When I look at C and Java code, it's always nicely indented.</p> <p>Always. Nicely. Indented. </p> <p>Clearly, C and Java folks spend a lot of time getting their whitespace right.</p> <p>So do Python programmers.</p>
2
2009-03-12T11:02:21Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
638,534
<p>If you use Eclipse as your IDE, you should take a look at PyDev; it handles indentation and spacing automatically. You can copy-paste from mixed-spacing sources, and it will convert them for you. Since I started learning the language, I've never once had to think about spacing.</p> <p>And it's really a non-issue;...
1
2009-03-12T13:05:08Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
639,229
<p>If your using emacs, set a hard tab length of 8 and a soft tab length of 4. This way you will be alterted to any extraneous tab characters. You should always uses 4 spaces instead of tabs.</p>
0
2009-03-12T15:40:53Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
639,262
<p>One drawback I experienced as a beginner whith python was forgetting to set softtabs in my editors gave me lots of trouble.</p> <p>But after a year of serious use of the language I'm not able to write poorly indented code anymore in any other language.</p>
0
2009-03-12T15:51:21Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
639,671
<p>Pitfalls</p> <ul> <li><p>It can be annoying posting code snippets on web sites that ignore your indentation.</p></li> <li><p>Its hard to see how multi-line anonymous functions (lambdas) can fit in with the syntax of the language.</p></li> <li><p>It makes it hard to embed Python in HTML files to make templates in th...
1
2009-03-12T17:33:41Z
[ "python", "whitespace" ]
Are there any pitfalls with using whitespace in Python?
637,295
<p>At the moment I have never had a problem with whitespace in Python (although I've only used it in two projects and I was the only programmer). What are some potential pitfalls with whitespace and indentation in Python for someone learning the language? </p>
3
2009-03-12T03:50:34Z
639,767
<p>No, I would say that is one thing to which I can find no downfalls. Yes, it is no doubt irritating to some, but that is just because they have a different habit about their style of formatting. Learn it early, and it's gonna stick. Just look how many discussions we have over a style matter in languages like C, Cpp, ...
0
2009-03-12T17:55:43Z
[ "python", "whitespace" ]
Default encoding for python for stderr?
637,396
<p>I've got a noisy python script that I want to silence by directing its stderr output to /dev/null (using bash BTW).</p> <p>Like so:</p> <pre><code>python -u parse.py 1&gt; /tmp/output3.txt 2&gt; /dev/null </code></pre> <p>but it quickly exits prematurely. Hmm. I can't see the traceback because of course that goe...
7
2009-03-12T04:45:51Z
637,411
<p>When stderr is not redirected, it takes on the encoding of your terminal. This all goes out the door when you redirect it though. You'll need to use sys.stderr.isatty() in order to detect if it's redirected and encode appropriately.</p>
4
2009-03-12T04:52:13Z
[ "python", "bash", "shell", "unicode" ]
Default encoding for python for stderr?
637,396
<p>I've got a noisy python script that I want to silence by directing its stderr output to /dev/null (using bash BTW).</p> <p>Like so:</p> <pre><code>python -u parse.py 1&gt; /tmp/output3.txt 2&gt; /dev/null </code></pre> <p>but it quickly exits prematurely. Hmm. I can't see the traceback because of course that goe...
7
2009-03-12T04:45:51Z
638,331
<p>You could also just encode the string as ASCII, replacing unicode characters that don't map. Then you don't have to worry about what kind of terminal you have.</p> <pre><code>asciiTitle = page_title.encode("ascii", "backslashreplace") print &gt;&gt;sys.stderr, "bad page title", asciiTitle </code></pre> <p>That re...
2
2009-03-12T12:06:07Z
[ "python", "bash", "shell", "unicode" ]
Default encoding for python for stderr?
637,396
<p>I've got a noisy python script that I want to silence by directing its stderr output to /dev/null (using bash BTW).</p> <p>Like so:</p> <pre><code>python -u parse.py 1&gt; /tmp/output3.txt 2&gt; /dev/null </code></pre> <p>but it quickly exits prematurely. Hmm. I can't see the traceback because of course that goe...
7
2009-03-12T04:45:51Z
638,823
<p>You can silence stderr by binding it to a custom writer:</p> <pre><code>#!/usr/bin/env python import codecs, sys class NullWriter: def write(self, *args, **kwargs): pass if len(sys.argv) == 2: if sys.argv[1] == '1': sys.stderr = NullWriter() elif sys.argv[1] == '2': #NOTE: sys.stderr...
5
2009-03-12T14:22:25Z
[ "python", "bash", "shell", "unicode" ]
On interface up, possible to scan for a specific MAC address?
637,399
<p>I admit the linux network system is somewhat foreign to me, I know enough of it to configure routes manually and assign a static IP if necessary.</p> <p>So quick question, in the ifconfig configuration files, is it possible to add a post connect hook to a python script then use a python script to reassign a hostnam...
0
2009-03-12T04:47:34Z
637,419
<p>Just make sure Avahi / Bonjour's running, then type <em>hostname</em>.local (or also try <em>hostname</em>.localdomain) - it resolves using mDNS, so you don't have to care what your IP is or rigging /etc/hosts.</p>
1
2009-03-12T04:54:23Z
[ "python", "linux", "networking", "sysadmin" ]
On interface up, possible to scan for a specific MAC address?
637,399
<p>I admit the linux network system is somewhat foreign to me, I know enough of it to configure routes manually and assign a static IP if necessary.</p> <p>So quick question, in the ifconfig configuration files, is it possible to add a post connect hook to a python script then use a python script to reassign a hostnam...
0
2009-03-12T04:47:34Z
637,939
<p>You could also use <strong>arp-scan</strong> (a Debian package of the name exists, not sure about other distributions) to scan your whole network. Have a script parse its output and you'll be all set.</p>
0
2009-03-12T09:58:39Z
[ "python", "linux", "networking", "sysadmin" ]
On interface up, possible to scan for a specific MAC address?
637,399
<p>I admit the linux network system is somewhat foreign to me, I know enough of it to configure routes manually and assign a static IP if necessary.</p> <p>So quick question, in the ifconfig configuration files, is it possible to add a post connect hook to a python script then use a python script to reassign a hostnam...
0
2009-03-12T04:47:34Z
637,992
<p>Sorry, it looks like an attempt to create a problem where no problem exists, and subsequently solve it using a bit crazy methods. :)</p> <p>You can configure your dhcp server (router) to always issue a fixed ip for your workstation. If you don't have dhcp server, then why do you use dhcp for configuring the interfa...
1
2009-03-12T10:15:28Z
[ "python", "linux", "networking", "sysadmin" ]
On interface up, possible to scan for a specific MAC address?
637,399
<p>I admit the linux network system is somewhat foreign to me, I know enough of it to configure routes manually and assign a static IP if necessary.</p> <p>So quick question, in the ifconfig configuration files, is it possible to add a post connect hook to a python script then use a python script to reassign a hostnam...
0
2009-03-12T04:47:34Z
672,780
<p>Cleanest solution would be to have a DHCP server that exchanges its assignments with a local DNS server. So regardless which IP address your workstation is being assigned to, it is accessible under the same hostname. </p> <p>This concept is used in every full-blown windows network as well as in any other well confi...
1
2009-03-23T09:59:38Z
[ "python", "linux", "networking", "sysadmin" ]
Django with Passenger
637,565
<p>I'm trying to get a trivial Django project working with Passenger on Dreamhost, following the instructions <a href="http://www.soasi.com/2008/09/django-10-on-dreamhost-with-passenger-mod_rails/"> here </a></p> <p>I've set up the directories exactly as in that tutorial, and ensured that django is on my PYTHONPATH (I...
8
2009-03-12T06:26:51Z
637,747
<p>Are those fancy quotation marks also in your code?</p> <pre><code>os.environ['DJANGO_SETTINGS_MODULE'] = ‘myproject.settings’ ^ ^ </code></pre> <p>If so, start by fixing them, as they cause a syntax error.</p>
24
2009-03-12T08:36:12Z
[ "python", "django", "passenger", "dreamhost" ]
Function Parser with RegEx in Python
637,773
<p>I have a source code in Fortran (almost irrelevant) and I want to parse the function names and arguments.</p> <p>eg using </p> <pre><code>(\w+)\([^\(\)]+\) </code></pre> <p>with</p> <pre><code>a(b(1 + 2 * 2), c(3,4)) </code></pre> <p>I get the following: (as expected)</p> <pre><code>b, 1 + 2 * 2 c, 3,4 </code>...
2
2009-03-12T08:52:44Z
637,781
<p>I don't think this is a job for regular expressions... they can't really handle nested patterns.</p> <p>This is because regexes are compiled into FSMs (Finite State Machines). In order to parse arbitrarily nested expressions, you can't use a FSM, because you need infinitely many states to keep track of the arbitrar...
2
2009-03-12T08:55:01Z
[ "python", "regex" ]
Function Parser with RegEx in Python
637,773
<p>I have a source code in Fortran (almost irrelevant) and I want to parse the function names and arguments.</p> <p>eg using </p> <pre><code>(\w+)\([^\(\)]+\) </code></pre> <p>with</p> <pre><code>a(b(1 + 2 * 2), c(3,4)) </code></pre> <p>I get the following: (as expected)</p> <pre><code>b, 1 + 2 * 2 c, 3,4 </code>...
2
2009-03-12T08:52:44Z
637,807
<p>This is a nonlinear grammar -- you need to be able to recurse on a set of allowed rules. Look at <a href="http://pyparsing.wikispaces.com/" rel="nofollow">pyparsing</a> to do simple CFG (Context Free Grammar) parsing via readable specifications.</p> <p>It's been a while since I've written out CFGs, and I'm probably...
2
2009-03-12T09:07:20Z
[ "python", "regex" ]
Function Parser with RegEx in Python
637,773
<p>I have a source code in Fortran (almost irrelevant) and I want to parse the function names and arguments.</p> <p>eg using </p> <pre><code>(\w+)\([^\(\)]+\) </code></pre> <p>with</p> <pre><code>a(b(1 + 2 * 2), c(3,4)) </code></pre> <p>I get the following: (as expected)</p> <pre><code>b, 1 + 2 * 2 c, 3,4 </code>...
2
2009-03-12T08:52:44Z
637,823
<p>It can be done with regular expressions-- use them to tokenize the string, and work with the tokens. i.e. see <code>re.Scanner</code>. Alternatively, just use pyparsing.</p>
2
2009-03-12T09:12:20Z
[ "python", "regex" ]
Function Parser with RegEx in Python
637,773
<p>I have a source code in Fortran (almost irrelevant) and I want to parse the function names and arguments.</p> <p>eg using </p> <pre><code>(\w+)\([^\(\)]+\) </code></pre> <p>with</p> <pre><code>a(b(1 + 2 * 2), c(3,4)) </code></pre> <p>I get the following: (as expected)</p> <pre><code>b, 1 + 2 * 2 c, 3,4 </code>...
2
2009-03-12T08:52:44Z
637,974
<p>You can't do this with regular expression only. It's sort of recursive. You should match first the most external function and its arguments, print the name of the function, then do the same (match the function name, then its arguments) with all its arguments. Regex alone are not enough.</p>
1
2009-03-12T10:10:35Z
[ "python", "regex" ]
Function Parser with RegEx in Python
637,773
<p>I have a source code in Fortran (almost irrelevant) and I want to parse the function names and arguments.</p> <p>eg using </p> <pre><code>(\w+)\([^\(\)]+\) </code></pre> <p>with</p> <pre><code>a(b(1 + 2 * 2), c(3,4)) </code></pre> <p>I get the following: (as expected)</p> <pre><code>b, 1 + 2 * 2 c, 3,4 </code>...
2
2009-03-12T08:52:44Z
641,844
<p>You can take a look at <a href="http://www.dabeaz.com/ply/" rel="nofollow">PLY (Python Lex-Yacc)</a>, it's (in my opinion) very simple to use and well documented, and it comes with a <a href="http://www.dabeaz.com/ply/example.html" rel="nofollow">calculator example</a> which could be a good starting point. </p>
2
2009-03-13T08:42:19Z
[ "python", "regex" ]
Showing page count with ReportLab
637,800
<p><br /> I'm trying to add a simple "page x of y" to a report made with ReportLab.. I found <a href="http://two.pairlist.net/pipermail/reportlab-users/2002-May/000020.html">this old post</a> about it, but maybe six years later something more straightforward has emerged? ^^;<br /> I found <a href="http://code.activesta...
12
2009-03-12T09:05:34Z
638,218
<p>Just digging up some code for you, we use this:</p> <pre><code>SimpleDocTemplate(...).build(self.story, onFirstPage=self._on_page, onLaterPages=self._on_page) </code></pre> <p>Now <code>self._on_page</code> is a method that gets called for each page like:</...
1
2009-03-12T11:29:03Z
[ "python", "reportlab" ]
Showing page count with ReportLab
637,800
<p><br /> I'm trying to add a simple "page x of y" to a report made with ReportLab.. I found <a href="http://two.pairlist.net/pipermail/reportlab-users/2002-May/000020.html">this old post</a> about it, but maybe six years later something more straightforward has emerged? ^^;<br /> I found <a href="http://code.activesta...
12
2009-03-12T09:05:34Z
639,993
<p>I was able to implement the NumberedCanvas approach from ActiveState. It was very easy to do and did not change much of my existing code. All I had to do was add that NumberedCanvas class and add the canvasmaker attribute when building my doc. I also changed the measurements of where the "x of y" was displayed:</p...
11
2009-03-12T18:54:30Z
[ "python", "reportlab" ]
Showing page count with ReportLab
637,800
<p><br /> I'm trying to add a simple "page x of y" to a report made with ReportLab.. I found <a href="http://two.pairlist.net/pipermail/reportlab-users/2002-May/000020.html">this old post</a> about it, but maybe six years later something more straightforward has emerged? ^^;<br /> I found <a href="http://code.activesta...
12
2009-03-12T09:05:34Z
7,758,773
<p>use doc.multiBuild</p> <p>and in the page header method (defined by "onLaterPages="):</p> <pre><code>global TOTALPAGES if doc.page &gt; TOTALPAGES: TOTALPAGES = doc.page else: canvas.drawString(270 * mm, 5 * mm, "Seite %d/%d" % (doc.page,TOTALPAGES)) </code></pre>
4
2011-10-13T18:32:55Z
[ "python", "reportlab" ]
How do I sum the first value in each tuple in a list of tuples in Python?
638,048
<p>I have a list of tuples (always pairs) like this:</p> <pre><code>[(0, 1), (2, 3), (5, 7), (2, 1)] </code></pre> <p>I'd like to find the sum of the first items in each pair, i.e.:</p> <pre><code>0 + 2 + 5 + 2 </code></pre> <p>How can I do this in Python? At the moment I'm iterating through the list: </p> <pre><c...
17
2009-03-12T10:37:27Z
638,055
<p>A version compatible with Python 2.3 is</p> <pre><code>sum([pair[0] for pair in list_of_pairs]) </code></pre> <p>or in recent versions of Python, see <a href="https://stackoverflow.com/a/638069/56541">this answer</a> or <a href="https://stackoverflow.com/a/10255912/56541">this one</a>.</p>
44
2009-03-12T10:39:31Z
[ "python", "list", "tuples" ]
How do I sum the first value in each tuple in a list of tuples in Python?
638,048
<p>I have a list of tuples (always pairs) like this:</p> <pre><code>[(0, 1), (2, 3), (5, 7), (2, 1)] </code></pre> <p>I'd like to find the sum of the first items in each pair, i.e.:</p> <pre><code>0 + 2 + 5 + 2 </code></pre> <p>How can I do this in Python? At the moment I'm iterating through the list: </p> <pre><c...
17
2009-03-12T10:37:27Z
638,069
<pre><code>sum(i for i, j in list_of_pairs) </code></pre> <p>will do too.</p>
30
2009-03-12T10:43:45Z
[ "python", "list", "tuples" ]
How do I sum the first value in each tuple in a list of tuples in Python?
638,048
<p>I have a list of tuples (always pairs) like this:</p> <pre><code>[(0, 1), (2, 3), (5, 7), (2, 1)] </code></pre> <p>I'd like to find the sum of the first items in each pair, i.e.:</p> <pre><code>0 + 2 + 5 + 2 </code></pre> <p>How can I do this in Python? At the moment I'm iterating through the list: </p> <pre><c...
17
2009-03-12T10:37:27Z
638,098
<p>If you have a very large list or a generator that produces a large number of pairs you might want to use a generator based approach. For fun I use <code>itemgetter()</code> and <code>imap()</code>, too. A simple generator based approach might be enough, though.</p> <pre><code>import operator import itertools idx0 =...
4
2009-03-12T10:52:48Z
[ "python", "list", "tuples" ]
How do I sum the first value in each tuple in a list of tuples in Python?
638,048
<p>I have a list of tuples (always pairs) like this:</p> <pre><code>[(0, 1), (2, 3), (5, 7), (2, 1)] </code></pre> <p>I'd like to find the sum of the first items in each pair, i.e.:</p> <pre><code>0 + 2 + 5 + 2 </code></pre> <p>How can I do this in Python? At the moment I'm iterating through the list: </p> <pre><c...
17
2009-03-12T10:37:27Z
638,193
<p>Obscure (but fun) answer:</p> <pre><code>&gt;&gt;&gt; sum(zip(*list_of_pairs)[0]) 9 </code></pre> <p>Or when zip's are iterables only this should work:</p> <pre><code>&gt;&gt;&gt; sum(zip(*list_of_pairs).__next__()) 9 </code></pre>
4
2009-03-12T11:19:19Z
[ "python", "list", "tuples" ]
How do I sum the first value in each tuple in a list of tuples in Python?
638,048
<p>I have a list of tuples (always pairs) like this:</p> <pre><code>[(0, 1), (2, 3), (5, 7), (2, 1)] </code></pre> <p>I'd like to find the sum of the first items in each pair, i.e.:</p> <pre><code>0 + 2 + 5 + 2 </code></pre> <p>How can I do this in Python? At the moment I'm iterating through the list: </p> <pre><c...
17
2009-03-12T10:37:27Z
10,255,912
<p>I recommend:</p> <pre><code>sum(i for i, _ in list_of_pairs) </code></pre> <p><em>Note</em>: </p> <p>Using the variable <code>_</code>(or <code>__</code> to avoid confliction with the alias of <code>gettext</code>) instead of <code>j</code> has at least two benefits:</p> <ol> <li><code>_</code>(which stands for ...
10
2012-04-21T03:24:43Z
[ "python", "list", "tuples" ]
Problem Inserting data into MS Access database using ADO via Python
638,095
<p>[Edit 2: More information and debugging in answer below...]</p> <p>I'm writing a python script to export MS Access databases into a series of text files to allow for more meaningful version control (I know - why Access? Why aren't I using existing solutions? Let's just say the restrictions aren't of a technical nat...
6
2009-03-12T10:52:29Z
638,763
<p>Is <code>data[i]</code> being treated as a string? What happens if you specifically cast it as a int/double when you set <code>rs.Fields[i].Value</code>?</p> <p>Also, what happens when you print out the contents of <code>rs.Fields[i].Value</code> after it is set?</p>
0
2009-03-12T14:08:47Z
[ "python", "ms-access", "ado", "comtypes" ]
Problem Inserting data into MS Access database using ADO via Python
638,095
<p>[Edit 2: More information and debugging in answer below...]</p> <p>I'm writing a python script to export MS Access databases into a series of text files to allow for more meaningful version control (I know - why Access? Why aren't I using existing solutions? Let's just say the restrictions aren't of a technical nat...
6
2009-03-12T10:52:29Z
639,031
<p>Not a complete answer yet, but it appears to be a problem during the update. I've added some further debugging code in the insertion process which generates the following (example of a single row being updated):</p> <pre><code>Inserted into field ID (type 3) insert value 1, field value now 1. Inserted into field Te...
0
2009-03-12T14:58:14Z
[ "python", "ms-access", "ado", "comtypes" ]
Problem Inserting data into MS Access database using ADO via Python
638,095
<p>[Edit 2: More information and debugging in answer below...]</p> <p>I'm writing a python script to export MS Access databases into a series of text files to allow for more meaningful version control (I know - why Access? Why aren't I using existing solutions? Let's just say the restrictions aren't of a technical nat...
6
2009-03-12T10:52:29Z
639,223
<p>And found an answer.</p> <pre><code> rs = client.CreateObject("ADODB.Recordset") </code></pre> <p>Needs to be:</p> <pre><code> rs = client.CreateObject("ADODB.Recordset", dynamic=True) </code></pre> <p>Now I just need to look into why. Just hope this question saves someone else a few hours...</p>
3
2009-03-12T15:39:32Z
[ "python", "ms-access", "ado", "comtypes" ]
Ruby on Rails versus Python
638,150
<p>I am in the field of data crunching and very soon might make a move to the world of web programming. Although I am fascinated both by Python and Ruby as both of them seem to be having every similar styles when it comes to writing business logic or data crunching logic.</p> <p>But when I start googling for web devel...
13
2009-03-12T11:06:40Z
638,160
<p>Ruby and Python are languages.</p> <p>Rails is a framework.</p> <p>So it is not really sensible to compare Ruby on Rails vs Python.</p> <p>There are Python Frameworks out there you should take a look at for a more direct comparison - <a href="http://wiki.python.org/moin/WebFrameworks">http://wiki.python.org/moin/...
25
2009-03-12T11:09:40Z
[ "python", "ruby" ]
Ruby on Rails versus Python
638,150
<p>I am in the field of data crunching and very soon might make a move to the world of web programming. Although I am fascinated both by Python and Ruby as both of them seem to be having every similar styles when it comes to writing business logic or data crunching logic.</p> <p>But when I start googling for web devel...
13
2009-03-12T11:06:40Z
638,800
<p>If you want Python screencasts, see ShowMeDo.com. I'm a co-founder, it is 3.5 yrs old and has over 400 Python screencasts (most are free) along with 600+ other free open-source topics: <a href="http://showmedo.com/videos/python">http://showmedo.com/videos/python</a></p> <p>In the Python section (linked) you'll see ...
9
2009-03-12T14:16:09Z
[ "python", "ruby" ]
Ruby on Rails versus Python
638,150
<p>I am in the field of data crunching and very soon might make a move to the world of web programming. Although I am fascinated both by Python and Ruby as both of them seem to be having every similar styles when it comes to writing business logic or data crunching logic.</p> <p>But when I start googling for web devel...
13
2009-03-12T11:06:40Z
639,045
<p>Ruby and Python have more similarities than differences; the same is true for Rails and Django, which are the leading web frameworks in the respective languages.</p> <p>Both languages and both frameworks are likely to be rewarding to work with - in personal, "fun" terms at least - I don't know what the job markets ...
3
2009-03-12T15:03:33Z
[ "python", "ruby" ]
Ruby on Rails versus Python
638,150
<p>I am in the field of data crunching and very soon might make a move to the world of web programming. Although I am fascinated both by Python and Ruby as both of them seem to be having every similar styles when it comes to writing business logic or data crunching logic.</p> <p>But when I start googling for web devel...
13
2009-03-12T11:06:40Z
639,650
<p>Ruby gets more attention than Python simply because Ruby has one clear favourite when it comes to web apps while Python has traditionally had a very splintered approach (Zope, Plone, Django, Pylons, Turbogears). The critical mass of having almost all developers using one system as opposed to a variety of individual ...
15
2009-03-12T17:28:55Z
[ "python", "ruby" ]
Python - How to calculate equal parts of two dictionaries?
638,360
<p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p> <pre><code>d1 = {0:['11','18','25','38'], 1:['11','18','25','38'], 2:['11','18','25','38'], 3:['11','18','25','38']} d2 = {0:['05','08','11','13','16','25','34...
4
2009-03-12T12:15:14Z
638,392
<p>in pseudocode:</p> <pre><code>Dictionary d3 = new Dictionary() for (i = 0 to min(d1.size(), d2.size())) { element shared = getSharedElements(d1[i], d2[i]); d3.store(i, shared); } function getsharedElements(array e1, array e2) { element e3 = new element(); for (int i = 0 to e1.length) { if (e2.contain...
-1
2009-03-12T12:26:47Z
[ "python", "list", "dictionary", "merge" ]
Python - How to calculate equal parts of two dictionaries?
638,360
<p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p> <pre><code>d1 = {0:['11','18','25','38'], 1:['11','18','25','38'], 2:['11','18','25','38'], 3:['11','18','25','38']} d2 = {0:['05','08','11','13','16','25','34...
4
2009-03-12T12:15:14Z
638,409
<p>Assuming this is Python, you want:</p> <pre><code>dict((x, set(y) &amp; set(d1.get(x, ()))) for (x, y) in d2.iteritems()) </code></pre> <p>to generate the resulting dictionary "d3".</p> <h3>Python 3.0+ version</h3> <pre><code>&gt;&gt;&gt; d3 = {k: list(set(d1.get(k,[])).intersection(v)) for k, v in d2.items()} {...
7
2009-03-12T12:30:54Z
[ "python", "list", "dictionary", "merge" ]
Python - How to calculate equal parts of two dictionaries?
638,360
<p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p> <pre><code>d1 = {0:['11','18','25','38'], 1:['11','18','25','38'], 2:['11','18','25','38'], 3:['11','18','25','38']} d2 = {0:['05','08','11','13','16','25','34...
4
2009-03-12T12:15:14Z
638,439
<p>The problem boils down to determining the common elements between the two entries. (To obtain the result for all entries, just enclose the code in a loop over all of them.) Furthermore, it looks like each entry is a set (i.e. it has not duplicate elements). Therefore, all you need to do is find the set intersecti...
1
2009-03-12T12:39:48Z
[ "python", "list", "dictionary", "merge" ]
Python - How to calculate equal parts of two dictionaries?
638,360
<p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p> <pre><code>d1 = {0:['11','18','25','38'], 1:['11','18','25','38'], 2:['11','18','25','38'], 3:['11','18','25','38']} d2 = {0:['05','08','11','13','16','25','34...
4
2009-03-12T12:15:14Z
638,762
<p>If we can assume d1 and d2 have the same keys:</p> <pre><code>d3 = {} for k in d1.keys(): intersection = set(d1[k]) &amp; set(d2[k]) d3[k] = [x for x in intersection] </code></pre> <p>Otherwise, if we can't assume that, then it is a little messier:</p> <pre><code>d3 = {} for k in set(d1.keys() + d2.keys()...
1
2009-03-12T14:08:18Z
[ "python", "list", "dictionary", "merge" ]
Python - How to calculate equal parts of two dictionaries?
638,360
<p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p> <pre><code>d1 = {0:['11','18','25','38'], 1:['11','18','25','38'], 2:['11','18','25','38'], 3:['11','18','25','38']} d2 = {0:['05','08','11','13','16','25','34...
4
2009-03-12T12:15:14Z
641,134
<p>Offering a more readable solution:</p> <pre><code>d3= {} for common_key in set(d1) &amp; set(d2): common_values= set(d1[common_key]) &amp; set(d2[common_key]) d3[common_key]= list(common_values) </code></pre> <h3>EDIT after suggestion:</h3> <p>If you want only keys having at least one common value item:</...
4
2009-03-13T01:15:00Z
[ "python", "list", "dictionary", "merge" ]
In stackless Python, can you send a channel over a channel?
638,464
<p>I do not have <em>stackless</em> currently running, so I can not try this myself.</p> <pre><code>import stackless ch1 = stackless.channel() ch2 = stackless.channel() ch1.send(ch2) ch3 = ch1.receive() </code></pre> <p>Are <em>ch2</em> and <em>ch3</em> then the same channel? Say:</p> <pre><code>text = "Hallo" ch2....
4
2009-03-12T12:46:57Z
638,843
<p>Yes. Just tested.</p> <pre><code>&gt;&gt;&gt; import stackless &gt;&gt;&gt; ch1 = stackless.channel() &gt;&gt;&gt; def a(): ... ch2 = stackless.channel() ... ch1.send(ch2) ... ch2.send("Hello") ... &gt;&gt;&gt; def b(): ... ch3 = ch1.receive() ... print ch3.receive() ... &gt;&gt;&gt; stackless.tasklet(a)() &lt...
4
2009-03-12T14:26:27Z
[ "python", "stackless", "python-stackless" ]
In stackless Python, can you send a channel over a channel?
638,464
<p>I do not have <em>stackless</em> currently running, so I can not try this myself.</p> <pre><code>import stackless ch1 = stackless.channel() ch2 = stackless.channel() ch1.send(ch2) ch3 = ch1.receive() </code></pre> <p>Are <em>ch2</em> and <em>ch3</em> then the same channel? Say:</p> <pre><code>text = "Hallo" ch2....
4
2009-03-12T12:46:57Z
639,563
<p>Channels send normal Python references so the data you send (channel, string, whatever) is exactly what is received.</p> <p>One example of sending a channel over a channel is when you use a tasklet as a service, that is, a tasklet listens on a channel for requests, does work, and returns the result. The request nee...
3
2009-03-12T17:05:14Z
[ "python", "stackless", "python-stackless" ]
Paging depending on grouping of items in Django
638,647
<p>For a website implemented in Django/Python we have the following requirement:</p> <p>On a view page there are 15 messages per web paging shown. When there are more two or more messages from the same source, that follow each other on the view, they should be grouped together. </p> <p>Maybe not clear, but with the f...
5
2009-03-12T13:36:19Z
638,752
<p>I have a simple, though not perfect, template-only solution for this. In the template you can regroup the records using the <code>regroup</code> template tag. After regrouping you can hide successive records from the same source:</p> <pre><code>{% regroup records by source as grouped_records %} {% for group in grou...
1
2009-03-12T14:05:47Z
[ "python", "sql", "mysql", "django", "django-models" ]
Paging depending on grouping of items in Django
638,647
<p>For a website implemented in Django/Python we have the following requirement:</p> <p>On a view page there are 15 messages per web paging shown. When there are more two or more messages from the same source, that follow each other on the view, they should be grouped together. </p> <p>Maybe not clear, but with the f...
5
2009-03-12T13:36:19Z
638,816
<p>I don't see any great way to do what you're trying to do directly. If you're willing to accept a little de-normalization, I would recommend a pre-save signal to mark messages as being at the head.</p> <pre><code>#In your model head = models.BooleanField(default=True) #As a signal plugin: def check_head(sender, **...
3
2009-03-12T14:20:47Z
[ "python", "sql", "mysql", "django", "django-models" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,917
<p>I would:</p> <ul> <li>lowercase the string</li> <li>replace all <code>[^a-z]</code> with <code>""</code></li> </ul> <p>Like that:</p> <pre><code>def strip_string_to_lowercase(): nonascii = re.compile('[^a-z]') return lambda s: nonascii.sub('', s.lower().strip()) </code></pre> <p>EDIT: It turns out that the o...
8
2009-03-12T14:39:28Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,920
<p>Not especially runtime efficient, but certainly nicer on poor, tired coder eyes:</p> <pre><code>def strip_string_and_lowercase(s): return ''.join(c for c in s.lower() if c in string.ascii_lowercase) </code></pre>
10
2009-03-12T14:39:48Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,937
<pre><code>&gt;&gt;&gt; import string &gt;&gt;&gt; a = "O235th@#$&amp;( er Ra{}|?&amp;lt;ndom" &gt;&gt;&gt; ''.join(i for i in a.lower() if i in string.ascii_lowercase) 'otheraltndom' </code></pre> <p>doing essentially the same as you.</p>
2
2009-03-12T14:42:47Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,944
<p>This is a typical application of list compehension:</p> <pre><code>import string s = "O235th@#$&amp;( er Ra{}|?&lt;ndom" print ''.join(c for c in s.lower() if c in string.ascii_lowercase) </code></pre> <p>It won't filter out "&lt;" (html entity), as in your example, but I assume that was accidental cut and past pr...
2
2009-03-12T14:43:57Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,945
<p>Personally I would use a regular expression and then convert the final string to lower case. I have no idea how to write it in Python, but the basic idea is to:</p> <ol> <li>Remove characters in string that don't match case-insensitive regex "<code>\w</code>"</li> <li>Convert string to lower-case</li> </ol> <p>or ...
0
2009-03-12T14:44:04Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
638,946
<p>Similar to @Dana's, but I think this sounds like a filtering job, and that should be visible in the code. Also without the need to explicitly call <code>join()</code>:</p> <pre><code>def strip_string_to_lowercase(s): return filter(lambda x: x in string.ascii_lowercase, s.lower()) </code></pre>
4
2009-03-12T14:44:10Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
639,272
<pre><code>&gt;&gt;&gt; filter(str.isalpha, "This is a Test").lower() 'thisisatest' &gt;&gt;&gt; filter(str.isalpha, "A235th@#$&amp;( er Ra{}|?&gt;ndom").lower() 'atherrandom' </code></pre>
17
2009-03-12T15:55:32Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
639,325
<p>Another solution (not that pythonic, but very fast) is to use string.translate - though note that this will not work for unicode. It's also worth noting that you can speed up <a href="http://stackoverflow.com/questions/638893/what-is-the-most-efficient-way-in-python-to-convert-a-string-to-all-lowercase-str/638920#6...
22
2009-03-12T16:06:22Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
639,404
<p>I added the filter solutions to Brian's code:</p> <pre><code>import string, re, timeit # Precomputed values (for str_join_set and translate) letter_set = frozenset(string.ascii_lowercase + string.ascii_uppercase) tab = string.maketrans(string.ascii_lowercase + string.ascii_uppercase, string...
2
2009-03-12T16:20:46Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
639,773
<h3>Python 2.x <code>translate</code> method</h3> <p>Convert to lowercase and filter non-ascii non-alpha characters:</p> <pre><code>from string import ascii_letters, ascii_lowercase, maketrans table = maketrans(ascii_letters, ascii_lowercase*2) deletechars = ''.join(set(maketrans('','')) - set(ascii_letters)) print...
5
2009-03-12T17:56:26Z
[ "python", "string" ]
What is the most efficient way in Python to convert a string to all lowercase stripping out all non-ascii alpha characters?
638,893
<p>I have a simple task I need to perform in Python, which is to convert a string to all lowercase and strip out all non-ascii non-alpha characters. </p> <p>For example:</p> <pre><code>"This is a Test" -&gt; "thisisatest" "A235th@#$&amp;( er Ra{}|?&gt;ndom" -&gt; "atherrandom" </code></pre> <p>I have a simple functi...
25
2009-03-12T14:35:42Z
7,861,632
<h3>Python 2.x:</h3> <pre><code>import string valid_chars= string.ascii_lowercase + string.ascii_uppercase def only_lower_ascii_alpha(text): return filter(valid_chars.__contains__, text).lower() </code></pre> <p>Works with either <code>str</code> or <code>unicode</code> arguments.</p> <pre><code>&gt;&gt;&gt; on...
0
2011-10-22T18:15:51Z
[ "python", "string" ]
Unable search names which contain three 7s in random order by AWK/Python/Bash
639,078
<p>I need to find names which contain three number 7 in the random order.</p> <p><strong>My attempt</strong></p> <p>We need to find first names which do not contain seven</p> <pre><code>ls | grep [^7] </code></pre> <p>Then, we could remove these matches from the whole space</p> <pre><code>ls [remove] ls | grep [^7...
0
2009-03-12T15:11:45Z
639,096
<p>I don't understand the part about "random order". How do you differentiate between the "order" when it's the same token that repeats? Is "a7b7" different from "c7d7" in the order of the 7s?</p> <p>Anyway, this ought to work:</p> <pre><code> ls *7*7*7* </code></pre> <p>It just let's the shell solve the problem, bu...
7
2009-03-12T15:15:27Z
[ "python", "regex", "bash", "awk" ]
Unable search names which contain three 7s in random order by AWK/Python/Bash
639,078
<p>I need to find names which contain three number 7 in the random order.</p> <p><strong>My attempt</strong></p> <p>We need to find first names which do not contain seven</p> <pre><code>ls | grep [^7] </code></pre> <p>Then, we could remove these matches from the whole space</p> <pre><code>ls [remove] ls | grep [^7...
0
2009-03-12T15:11:45Z
639,212
<p>I'm guessing you want to find files that contain exactly three 7's, but no more. Using gnu grep with the extends regexp switch (<code>-E</code>):</p> <pre><code> ls | grep -E '^([^7]*7){3}[^7]*$' </code></pre> <p>Should do the trick.</p> <p>Basically that matches 3 occurrences of "not 7 followed by a 7", then a ...
5
2009-03-12T15:35:32Z
[ "python", "regex", "bash", "awk" ]
Unable search names which contain three 7s in random order by AWK/Python/Bash
639,078
<p>I need to find names which contain three number 7 in the random order.</p> <p><strong>My attempt</strong></p> <p>We need to find first names which do not contain seven</p> <pre><code>ls | grep [^7] </code></pre> <p>Then, we could remove these matches from the whole space</p> <pre><code>ls [remove] ls | grep [^7...
0
2009-03-12T15:11:45Z
639,446
<p>Something like this:</p> <pre><code>printf '%s\n' *|awk -F7 NF==4 </code></pre>
2
2009-03-12T16:31:29Z
[ "python", "regex", "bash", "awk" ]
Unable search names which contain three 7s in random order by AWK/Python/Bash
639,078
<p>I need to find names which contain three number 7 in the random order.</p> <p><strong>My attempt</strong></p> <p>We need to find first names which do not contain seven</p> <pre><code>ls | grep [^7] </code></pre> <p>Then, we could remove these matches from the whole space</p> <pre><code>ls [remove] ls | grep [^7...
0
2009-03-12T15:11:45Z
639,473
<p>Or instead of doing it in a single grep, use one grep to find files with 3-or-more 7s and another to filter out 4-or-more 7s.</p> <pre><code>ls -f | egrep '7.*7.*7' | grep -v '7.*7.*7.*7' </code></pre> <p>You could move some of the work into the shell glob with the shorter</p> <pre><code>ls -f *7*7*7* | grep -v '...
1
2009-03-12T16:39:21Z
[ "python", "regex", "bash", "awk" ]
Unable search names which contain three 7s in random order by AWK/Python/Bash
639,078
<p>I need to find names which contain three number 7 in the random order.</p> <p><strong>My attempt</strong></p> <p>We need to find first names which do not contain seven</p> <pre><code>ls | grep [^7] </code></pre> <p>Then, we could remove these matches from the whole space</p> <pre><code>ls [remove] ls | grep [^7...
0
2009-03-12T15:11:45Z
639,517
<p>A Perl solution:</p> <pre><code>$ ls | perl -ne 'print if (tr/7/7/ == 3)' 3777 4777 5777 6777 7077 7177 7277 7377 7477 7577 7677 ... </code></pre> <p>(I happen to have a directory with 4-digit numbers. 1777 and 2777 don't exist. :-)</p>
2
2009-03-12T16:53:43Z
[ "python", "regex", "bash", "awk" ]
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,209
<p>AFAIK, given a class and no other information, you can't tell whether or not it's a nested class. However, <a href="http://mail.python.org/pipermail/python-list/2005-July/330874.html">see here</a> for how you might use a decorator to determine this.</p> <p>The problem is that a nested class is simply a normal class...
12
2009-03-12T15:34:51Z
[ "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,412
<p>An inner class offers no particular special features in Python. It's only a property of the class object, no different from an integer or string property. Your OuterClass/InnerClass example can be rewritten exactly as:</p> <pre><code>class OuterClass(): pass class InnerClass(): pass OuterClass.InnerClass= InnerClas...
5
2009-03-12T16:23:04Z
[ "python", "introspection", "inner-classes" ]