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
Is there a Python library for connecting to a PostgreSQL 8.4 server using certificate authentication?
2,118,846
<p>We are in the process of upgrading from PostgreSQL 8.3 to PostgreSQL 8.4, in a large part so that we can start using <a href="http://www.postgresql.org/docs/8.4/interactive/auth-methods.html#AUTH-CERT" rel="nofollow">certificate-based authentication</a>.</p> <p>We have some Python 2.x code that accesses the databas...
0
2010-01-22T16:46:07Z
2,119,705
<p>psycopg2 is based on libpq, so it should work there. I don't think there's a specific interface for it, so you'll have to use the environment variables (see the libpq documentation) to control it, but it should work. (disclaimer: I haven't actually tried it, but anything on top of libpq <em>should</em> work)</p>
2
2010-01-22T19:02:03Z
[ "python", "authentication", "postgresql", "certificate" ]
In wxPython, What is the Standard Process of Making an Application Slightly More Complex Than a Wizard?
2,119,067
<p>I am attempting to create my first OS-level GUI using wxPython. I have the book <em>wxPython in Action</em> and have looked at the code demos. I have no experience with event-driven programming (aside from some Javascript), sizers, and all of the typical GUI elements. The book is organized a little strangely and ...
3
2010-01-22T17:16:51Z
2,120,967
<p>I don't have a good understanding of your application, but trying to force wxWizard to suit your needs sounds like a bad idea.</p> <p>I suggest checking out the Demos available from the wxPython website. Go through each demo and I bet you'll find one that suits your needs.</p> <p>I've personally never used wxWiza...
1
2010-01-22T22:22:18Z
[ "python", "wxpython" ]
How to separate one list in two via list comprehension or otherwise
2,119,112
<p>If have a list of dictionary items like so:</p> <pre><code>L = [{"a":1, "b":0}, {"a":3, "b":1}...] </code></pre> <p>I would like to split these entries based upon the value of "b", either 0 or 1. </p> <pre><code>A(b=0) = [{"a":1, "b":1}, ....] B(b=1) = [{"a":3, "b":2}, .....] </code></pre> <p>I am comfortable wi...
1
2010-01-22T17:23:42Z
2,119,143
<p>Don't use a list comprehension. List comprehensions are for when you want a single list result. You obviously don't :) Use a regular for loop:</p> <pre><code>A = [] B = [] for item in L: if item['b'] == 0: target = A else: target = B target.append(item) </code></pre> <p>You can shorten ...
4
2010-01-22T17:27:07Z
[ "python", "list", "list-comprehension" ]
How to separate one list in two via list comprehension or otherwise
2,119,112
<p>If have a list of dictionary items like so:</p> <pre><code>L = [{"a":1, "b":0}, {"a":3, "b":1}...] </code></pre> <p>I would like to split these entries based upon the value of "b", either 0 or 1. </p> <pre><code>A(b=0) = [{"a":1, "b":1}, ....] B(b=1) = [{"a":3, "b":2}, .....] </code></pre> <p>I am comfortable wi...
1
2010-01-22T17:23:42Z
2,119,593
<p>If the <code>b</code> value can be only 0 or 1, @Thomas's simple solution is probably best. For a more general case (in which you want to discriminate among several possible values of <code>b</code> -- your sample "expected results" appear to be completely divorced from and contradictory to your question's text, so ...
3
2010-01-22T18:41:02Z
[ "python", "list", "list-comprehension" ]
python : mysql : Return 0 when no rows found
2,119,153
<p>Table structure - Data present for 5 min. slots -</p> <p><b>data_point | point_date</b> <p>12 | 00:00<br> <p>14 | 00:05<br> <p>23 | 00:10<br> <p>10 | 00:15<br> <p>43 | 00:25<br> <p>10 | 00:40 </p> <p>When I run the query for say 30 mins. and i...
1
2010-01-22T17:28:44Z
2,119,384
<p>I see no easy way to create non-existing records out of thin air, but you could create yourself a point_dates table containing all the timestamps you're interested in, and left join it on your data:</p> <p><code>select pd.slot, IFNULL(data_point, 0) from point_dates pd left join some_table st on st.point_date=pd.sl...
0
2010-01-22T18:07:00Z
[ "python", "mysql", null ]
python : mysql : Return 0 when no rows found
2,119,153
<p>Table structure - Data present for 5 min. slots -</p> <p><b>data_point | point_date</b> <p>12 | 00:00<br> <p>14 | 00:05<br> <p>23 | 00:10<br> <p>10 | 00:15<br> <p>43 | 00:25<br> <p>10 | 00:40 </p> <p>When I run the query for say 30 mins. and i...
1
2010-01-22T17:28:44Z
2,119,402
<p>You cannot query data you do not have.</p> <p>You (as a thinking person) can claim that the 00:20 data is missing; but there's no easy way to define "missing" in some more formal SQL sense.</p> <p>The best you can do is create a table with all of the expected times.</p> <p>Then you can do an outer join between ex...
0
2010-01-22T18:09:27Z
[ "python", "mysql", null ]
python : mysql : Return 0 when no rows found
2,119,153
<p>Table structure - Data present for 5 min. slots -</p> <p><b>data_point | point_date</b> <p>12 | 00:00<br> <p>14 | 00:05<br> <p>23 | 00:10<br> <p>10 | 00:15<br> <p>43 | 00:25<br> <p>10 | 00:40 </p> <p>When I run the query for say 30 mins. and i...
1
2010-01-22T17:28:44Z
2,123,394
<p>Yes, you can do that using SQL only. A solution would be to use a Stored Routine. The bellow Stored Procedure produces following output:</p> <pre><code>start cnt 00:05:00 1 00:10:00 0 00:15:00 1 00:20:00 0 00:25:00 1 00:30:00 0 00:35:00 1 00:40:00 0 00:45:00 0 00:50:00 0 00:55:00 2 </code></...
1
2010-01-23T14:07:02Z
[ "python", "mysql", null ]
virtual serial port on Arch linux
2,119,217
<p>I am using Arch linux and I need to create virtual serial port on it. I tried everything but it seems doesnt work. All I want is to connect that virtual port to another virtual port over TCP and after that to use it in my python application to communicate with python application to other side. Is that posible? Pleas...
2
2010-01-22T17:39:19Z
2,648,514
<h2>socat command is solution.</h2> <p>First you need to install socat:</p> <h2>pacman -S socat</h2> <p>Just insert this in console, but first you should be login as root:</p> <p>socat PTY,link=/dev/ttyVirtualS0,echo=0 PTY,link=/dev/ttyVirtualS1,echo=0</p> <p>and now we have two virtual serial ports which are virt...
3
2010-04-15T19:51:31Z
[ "python" ]
Python: file with programmer-defined attributes
2,119,341
<p>Using Python 2.5, I'd like to create a temporary file, but add (&amp; modify) attributes of my own. I've tried the following:</p> <pre><code>class TempFileWithAttributes ( ) : __slots__ = [ '_tempFile' , 'Value' ] def __init__ ( self ) : self._tempFile = tempfile.TemporaryFile() ...
1
2010-01-22T17:57:22Z
2,119,415
<p>First step: use <code>setattr()</code> instead of <code>object.__setattr__()</code> </p> <p>Second step: Instead of <code>setattr(anobject, 'string', value)</code> just use <code>anobject.string = value</code></p> <p>Because your code makes no sense whatsoever. I can't even figure out what you are trying to do.</p...
0
2010-01-22T18:11:06Z
[ "python", "file", "subclassing" ]
Python: file with programmer-defined attributes
2,119,341
<p>Using Python 2.5, I'd like to create a temporary file, but add (&amp; modify) attributes of my own. I've tried the following:</p> <pre><code>class TempFileWithAttributes ( ) : __slots__ = [ '_tempFile' , 'Value' ] def __init__ ( self ) : self._tempFile = tempfile.TemporaryFile() ...
1
2010-01-22T17:57:22Z
2,119,467
<p>Why are you overriding <code>__setattr__</code> <strong>at all</strong>?! You're not doing anything useful in your override -- and your override of <code>__getattr__</code> isn't being very helpful either. I think what you want is rather something like:</p> <pre><code>&gt;&gt;&gt; class TempFileWithAttributes(ob...
2
2010-01-22T18:19:30Z
[ "python", "file", "subclassing" ]
Python: file with programmer-defined attributes
2,119,341
<p>Using Python 2.5, I'd like to create a temporary file, but add (&amp; modify) attributes of my own. I've tried the following:</p> <pre><code>class TempFileWithAttributes ( ) : __slots__ = [ '_tempFile' , 'Value' ] def __init__ ( self ) : self._tempFile = tempfile.TemporaryFile() ...
1
2010-01-22T17:57:22Z
15,370,928
<p>Python complains about <code>object.__setattr__ (self, 'Value', newValue )</code> because <code>self</code> is not an <code>object</code>.</p> <p>What you need is to inherit from object:</p> <pre><code>class TempFileWithAttributes(object): </code></pre> <p>In Python3 that happens by default, but in Python2 it do...
0
2013-03-12T19:57:51Z
[ "python", "file", "subclassing" ]
Convert a timedelta to days, hours and minutes
2,119,472
<p>I've got a timedelta. I want the days, hours and minutes from that - either as a tuple or a dictionary... I'm not fussed.</p> <p>I must have done this a dozen times in a dozen languages over the years but Python usually has a simple answer to everything so I thought I'd ask here before busting out some nauseatingly...
79
2010-01-22T18:20:38Z
2,119,499
<p>timedeltas have a <code>days</code> and <code>seconds</code> attribute .. you can convert them yourself with ease.</p>
-1
2010-01-22T18:24:25Z
[ "python", "timedelta" ]
Convert a timedelta to days, hours and minutes
2,119,472
<p>I've got a timedelta. I want the days, hours and minutes from that - either as a tuple or a dictionary... I'm not fussed.</p> <p>I must have done this a dozen times in a dozen languages over the years but Python usually has a simple answer to everything so I thought I'd ask here before busting out some nauseatingly...
79
2010-01-22T18:20:38Z
2,119,509
<pre class="lang-py prettyprint-override"><code>days, hours, minutes = td.days, td.seconds // 3600, td.seconds // 60 % 60 </code></pre> <p>As for DST, I think the best thing is to convert both <code>datetime</code> objects to seconds. This way the system calculates DST for you.</p> <pre><code>&gt;&gt;&gt; m13 = datet...
12
2010-01-22T18:25:45Z
[ "python", "timedelta" ]
Convert a timedelta to days, hours and minutes
2,119,472
<p>I've got a timedelta. I want the days, hours and minutes from that - either as a tuple or a dictionary... I'm not fussed.</p> <p>I must have done this a dozen times in a dozen languages over the years but Python usually has a simple answer to everything so I thought I'd ask here before busting out some nauseatingly...
79
2010-01-22T18:20:38Z
2,119,512
<p>If you have a <code>datetime.timedelta</code> value <code>td</code>, <code>td.days</code> already gives you the "days" you want. <code>timedelta</code> values keep fraction-of-day as seconds (not directly hours or minutes) so you'll indeed have to perform "nauseating simple mathematics", e.g.:</p> <pre class="lang-...
115
2010-01-22T18:26:00Z
[ "python", "timedelta" ]
Convert a timedelta to days, hours and minutes
2,119,472
<p>I've got a timedelta. I want the days, hours and minutes from that - either as a tuple or a dictionary... I'm not fussed.</p> <p>I must have done this a dozen times in a dozen languages over the years but Python usually has a simple answer to everything so I thought I'd ask here before busting out some nauseatingly...
79
2010-01-22T18:20:38Z
7,839,673
<p>I don't understand </p> <pre><code>days, hours, minutes = td.days, td.seconds // 3600, td.seconds // 60 % 60 </code></pre> <p>how about this</p> <pre><code>days, hours, minutes = td.days, td.seconds // 3600, td.seconds % 3600 / 60.0 </code></pre> <p>You get minutes and seconds of a minute as a float.</p>
4
2011-10-20T17:19:05Z
[ "python", "timedelta" ]
Convert a timedelta to days, hours and minutes
2,119,472
<p>I've got a timedelta. I want the days, hours and minutes from that - either as a tuple or a dictionary... I'm not fussed.</p> <p>I must have done this a dozen times in a dozen languages over the years but Python usually has a simple answer to everything so I thought I'd ask here before busting out some nauseatingly...
79
2010-01-22T18:20:38Z
10,981,895
<p>This is a bit more compact, you get the hours, minutes and seconds in two lines.</p> <pre><code>hours, remainder = divmod(td.seconds, 3600) minutes, seconds = divmod(remainder, 60) </code></pre>
35
2012-06-11T14:16:53Z
[ "python", "timedelta" ]
python: convert UUID to a string which is a C unsigned char[16] initializer
2,119,500
<p>(in case you're curious about motivation: this will be used in a <a href="http://www.scons.org/" rel="nofollow">scons</a> build to generate a C file containing a GUID)</p> <p>I found the question about <a href="http://stackoverflow.com/questions/534839/how-to-create-a-guid-in-python">generating a GUID in python</a>...
0
2010-01-22T18:24:33Z
2,119,517
<pre><code>hex(ord(b)) </code></pre> <p>...</p>
2
2010-01-22T18:27:57Z
[ "python" ]
Django forms: how do I display the initial blank form?
2,119,682
<p>I have this view function:</p> <pre><code>def search(request): if request.method == 'GET': form = SearchForm(request.GET) if form.is_valid(): last_name = form.cleaned_data['last_name'] first_name = form.cleaned_data['first_name'] lawyers = Lawyer.objects.all()...
0
2010-01-22T18:56:43Z
2,119,725
<p>Every normal HTTP request (like when you go to <a href="http://stackoverflow.com">http://stackoverflow.com</a>) is a GET request. It is generally a good idea to use POST as the method of your forms when they change some data.</p> <p>You should read: <a href="http://stackoverflow.com/questions/46585/when-do-you-use-...
2
2010-01-22T19:04:09Z
[ "python", "django-forms" ]
Django forms: how do I display the initial blank form?
2,119,682
<p>I have this view function:</p> <pre><code>def search(request): if request.method == 'GET': form = SearchForm(request.GET) if form.is_valid(): last_name = form.cleaned_data['last_name'] first_name = form.cleaned_data['first_name'] lawyers = Lawyer.objects.all()...
0
2010-01-22T18:56:43Z
2,119,752
<p>When you post a form with <code>method=GET</code> you don't actually change the method from the initial request: it was <code>method=GET</code> too.</p> <p>You can either use <code>method=POST</code> in your form, and your if statement will check for that, or you could check for the existence of the required fields...
1
2010-01-22T19:08:07Z
[ "python", "django-forms" ]
Calling a python function from bash script
2,119,702
<p>I have an "alarm email" function inside a python module. I want to be able to call this function from a bash script. I know you can call a module using 'python ' in the script, but I'm not if you can or how you would call a specific function within the module.</p>
10
2010-01-22T19:00:27Z
2,119,716
<p>You can use the <code>-c</code> option:</p> <pre><code>python -c "import random; print random.uniform(0, 1)" </code></pre> <p>Modify as you need.</p>
13
2010-01-22T19:03:05Z
[ "python", "bash", "function", "scripting" ]
Calling a python function from bash script
2,119,702
<p>I have an "alarm email" function inside a python module. I want to be able to call this function from a bash script. I know you can call a module using 'python ' in the script, but I'm not if you can or how you would call a specific function within the module.</p>
10
2010-01-22T19:00:27Z
2,119,728
<pre><code>python -c'import themodule; themodule.thefunction("boo!")' </code></pre>
23
2010-01-22T19:04:19Z
[ "python", "bash", "function", "scripting" ]
Calling a python function from bash script
2,119,702
<p>I have an "alarm email" function inside a python module. I want to be able to call this function from a bash script. I know you can call a module using 'python ' in the script, but I'm not if you can or how you would call a specific function within the module.</p>
10
2010-01-22T19:00:27Z
2,120,343
<p>To call a specific function in a module, assure that the module has the following:</p> <pre><code>if __name__ == "__main__": the_function_to_call( ) </code></pre> <p>Then you can simply do this in your shell script.</p> <pre><code>python module.py </code></pre> <p>Or</p> <pre><code>python -m module </code><...
2
2010-01-22T20:40:37Z
[ "python", "bash", "function", "scripting" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,119,943
<p>An easy speedup is to use a larger 'chunk':</p> <pre><code>def faster_xor(aa,bb): a=frombuffer(aa,dtype=uint64) b=frombuffer(bb,dtype=uint64) c=bitwise_xor(a,b) r=c.tostring() return r </code></pre> <p>with <code>uint64</code> also imported from <code>numpy</code> of course. I <code>timeit</co...
10
2010-01-22T19:39:34Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,120,034
<p>You could try the symmetric difference of the bitsets of sage.</p> <p><a href="http://www.sagemath.org/doc/reference/sage/misc/bitset.html" rel="nofollow">http://www.sagemath.org/doc/reference/sage/misc/bitset.html</a></p>
0
2010-01-22T19:51:21Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,124,791
<p>If you want to do fast operations on array data types, then you should try Cython (cython.org). If you give it the right declarations it should be able to compile down to pure c code.</p>
1
2010-01-23T21:22:26Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,165,474
<p>The fastest way (speedwise) will be doing what Max. S recommended. Implement it in C.</p> <p>The supporting code for this task should be rather simple to write. It is just one function in a module creating a new string and doing the xor. That's all. When you have implemented one module like that, it is simple to ta...
0
2010-01-29T22:01:25Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,170,096
<p>Get rid of the function call, and do the xor operation inline.</p>
0
2010-01-31T00:36:21Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,173,328
<p>Your problem isn't the speed of NumPy's xOr method, but rather with all of the buffering/data type conversions. Personally I suspect that the point of this post may have really been to brag about Python, because what you are doing here is processing THREE GIGABYTES of data in timeframes on par with non-interpreted ...
5
2010-01-31T21:06:25Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,174,000
<p>Here are my results for cython</p> <pre><code>slow_xor 0.456888198853 faster_xor 0.400228977203 cython_xor 0.232881069183 cython_xor_vectorised 0.171468019485 </code></pre> <p>Vectorising in cython shaves about 25% off the for loop on my computer, However more than half the time is spent building the python stri...
17
2010-02-01T00:22:05Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,179,687
<h1>First Try</h1> <p>Using <a href="http://www.scipy.org/Weave"><code>scipy.weave</code></a> and <a href="http://en.wikipedia.org/wiki/SSE2">SSE2</a> intrinsics gives a marginal improvement. The first invocation is a bit slower since the code needs to be loaded from the disk and cached, subsequent invocations are fas...
29
2010-02-01T20:07:58Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,188,621
<p>The fastest bitwise XOR is "^". I can type that <em>much</em> quicker than "bitwise_xor" ;-)</p>
3
2010-02-02T23:44:17Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,566,106
<h2>Performance comparison: numpy vs. Cython vs. C vs. Fortran vs. Boost.Python (pyublas)</h2> <pre><code>| function | time, usec | ratio | type | |------------------------+------------+-------+--------------| | slow_xor | 2020 | 1.0 | numpy | | xorf_int16 ...
33
2010-04-02T10:15:59Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
2,569,156
<p>How badly do you need the answer as a string? Note that the <code>c.tostring()</code> method has to <em>copy</em> the data in <code>c</code> to a new string, as Python strings are immutable (and <code>c</code> is mutable). Python 2.6 and 3.1 have a <code>bytearray</code> type, which acts like <code>str</code> (<code...
1
2010-04-02T20:55:44Z
[ "python", "algorithm", "performance", "xor" ]
Simple Python Challenge: Fastest Bitwise XOR on Data Buffers
2,119,761
<p><strong>Challenge:</strong></p> <p>Perform a bitwise XOR on two equal sized buffers. The buffers will be required to be the python <code>str</code> type since this is traditionally the type for data buffers in python. Return the resultant value as a <code>str</code>. Do this as fast as possible.</p> <p>The inputs ...
47
2010-01-22T19:08:49Z
23,495,354
<p>Python3 has <code>int.from_bytes</code> and <code>int.to_bytes</code>, thus:</p> <pre><code>x = int.from_bytes(b"a" * (1024*1024), "big") y = int.from_bytes(b"b" * (1024*1024), "big") (x ^ y).to_bytes(1024*1024, "big") </code></pre> <p>It's faster than IO, kinda hard to test just how fast it is, looks like <strong...
1
2014-05-06T12:55:34Z
[ "python", "algorithm", "performance", "xor" ]
How to make pyuic4 automatically set tabs to "MainWindow"?
2,120,232
<p>After adding a new label and textEdit to a grid right above these tabs, When I generate the ui.py file with pyuic4, It generates the the following lines for many different tabs which gives errors about not having enough arguments.</p> <pre><code>self.tcTab.setTabText(self.tcTab.indexOf(self.tab_6),) </code></pre> ...
2
2010-01-22T20:22:11Z
2,166,002
<p>YAY!!!!</p> <p>The setTabText field for tabs when using designer must have something in it. It turns out the ui was using white spaces as the tabText, whenever you open designer it got rid of the white spaces. So if you set the tab text to a space again after making your changes it works.</p>
1
2010-01-29T23:31:10Z
[ "python", "qt", "pyqt", "designer" ]
ImportError: Model A references Model B, Model B references Model A
2,120,332
<p>I think this is more a python question than Django.</p> <p>But basically I'm doing at Model A:</p> <pre><code>from myproject.modelb.models import ModelB </code></pre> <p>and at Model B:</p> <pre><code>from myproject.modela.models import ModelA </code></pre> <p>Result:</p> <blockquote> <p>cannot import name M...
2
2010-01-22T20:38:46Z
2,120,402
<p>A Python module is imported by executing it top to bottom in a new namespace. When module A imports module B, the evaluation of A.py is paused until module B is loaded. When module B then imports module A, it gets the partly-initialized namespace of module A -- in your case, it lacks the <code>ModelA</code> class be...
6
2010-01-22T20:48:52Z
[ "python", "django", "circular-dependency" ]
ImportError: Model A references Model B, Model B references Model A
2,120,332
<p>I think this is more a python question than Django.</p> <p>But basically I'm doing at Model A:</p> <pre><code>from myproject.modelb.models import ModelB </code></pre> <p>and at Model B:</p> <pre><code>from myproject.modela.models import ModelA </code></pre> <p>Result:</p> <blockquote> <p>cannot import name M...
2
2010-01-22T20:38:46Z
2,120,425
<p>Mutual imports usually mean you've designed your models incorrectly.</p> <p>When A depends on B, you should not have B also depending on A.</p> <p>Break B into two parts.</p> <p>B1 - depends on A.</p> <p>B2 - does not depend on A.</p> <p>A depends on B1. B1 depends on B2. Circularity removed.</p>
2
2010-01-22T20:53:21Z
[ "python", "django", "circular-dependency" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,120,479
<p>Because it takes a alot of processing to do all of that. ITs not a matter of "query, replace, render". All of thes products are made to fit a wide range of use cases and to be extensible to some degree so really those 3 basic operations your are talking about are split up into many, many operations all of which cons...
2
2010-01-22T21:00:48Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,120,517
<p>They are relatively complex systems. They allow a lot of hooks for plugins, so there's a lot of steps in the workflow from request to response.</p> <p>In the real world, however, caching (whether in-application or opcode caching) is a tremendous boost to performance.</p> <p>I'm not familiar with Plone, but the PH...
1
2010-01-22T21:08:30Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,120,558
<p>In my opinion :</p> <p>Because CMS and frameworks think of all the things you need, that you can use: like </p> <ul> <li>Filter userinput</li> <li>Create PDF,AJAX Output Template and alot more</li> </ul> <p>It Depends on your need, what you realy need</p> <p>Im not agree what you wrote</p> <blockquote> <p>A C...
0
2010-01-22T21:13:31Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,120,611
<p>Please don't take offense to this, but to preface your question by explaining your unfamiliarity with web programming, and then criticize the performance of what appears to you to be a 'simple' operation is a bit short-sighted.</p> <p>I would encourage you to learn a bit more about the common problems a CMS solves,...
1
2010-01-22T21:21:08Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,122,184
<blockquote> <p>A CMS should just query a DB and churn out the data packed into nice templates. </p> </blockquote> <p>Not so much. Major, modern CMS systems are incredibly complex beasts. A typical page isn't merely body text and a title, but also dynamic category-based content queries that aggregate info across man...
3
2010-01-23T04:58:50Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,129,774
<p>They are slow for a few reasons:</p> <p>1 - Most of them are very modular,that means more files, more code and more DB queries.</p> <p>2 - They largely (not wordpress so much) try to do everything, again designing a system for every possible situation makes it more complex and harder to tune.</p> <p>3 - Most of t...
2
2010-01-25T01:51:59Z
[ "php", "python", "content-management-system", "benchmarking" ]
Web CMS Performance: pages/second (Joomla, Drupal, Plone, WP)
2,120,443
<p>Note: I am not into web programming, so forgive my ignorance in case the question is trivial. Also, please don't comment about "how flawed" the out-of-box comparison of these products is. The question is not about how they compete against each other, rather about the reason behind the incredible slowness of ALL of t...
4
2010-01-22T20:56:06Z
2,212,856
<p>A CMS Does a lot more things alot more ...</p> <p>And at last but not least dont compare Desktop Software Speed with Wep Aplication.</p> <p>There is a Big Difference</p>
0
2010-02-06T10:56:40Z
[ "php", "python", "content-management-system", "benchmarking" ]
Why do Python function docs include the comma after the bracket for optional args?
2,120,507
<p>The format of the function signatures in the Python docs is a bit confusing. What is the significance in putting the comma after the open bracket, rather than before? What is the significance of nesting the brackets?</p> <p>How they are:</p> <pre><code>RegexObject.match(string[, pos[, endpos]]) </code></pre> <p...
4
2010-01-22T21:06:36Z
2,120,518
<p>The square bracket means that the contents are optional, but everything outside of square brackets is compulsory.</p> <p>With your notation:</p> <pre><code>RegexObject.match(string, [pos], [endpos]) </code></pre> <p>I would expect to have to write:</p> <pre><code>r.match("foo",,) </code></pre> <p>The nesting is...
14
2010-01-22T21:08:59Z
[ "python", "documentation", "notation" ]
Why do Python function docs include the comma after the bracket for optional args?
2,120,507
<p>The format of the function signatures in the Python docs is a bit confusing. What is the significance in putting the comma after the open bracket, rather than before? What is the significance of nesting the brackets?</p> <p>How they are:</p> <pre><code>RegexObject.match(string[, pos[, endpos]]) </code></pre> <p...
4
2010-01-22T21:06:36Z
2,120,519
<p>The open bracket indicates an optional argument. If the comma were outside the bracket, you would have to type it even if you didn't want to use the <code>pos</code> argument (for example).</p>
2
2010-01-22T21:09:05Z
[ "python", "documentation", "notation" ]
Why do Python function docs include the comma after the bracket for optional args?
2,120,507
<p>The format of the function signatures in the Python docs is a bit confusing. What is the significance in putting the comma after the open bracket, rather than before? What is the significance of nesting the brackets?</p> <p>How they are:</p> <pre><code>RegexObject.match(string[, pos[, endpos]]) </code></pre> <p...
4
2010-01-22T21:06:36Z
2,120,521
<p>Because otherwise the correct syntax would be to include the comma even if you are ignoring the arguments. The parts inside the square brackets are optional, so by moving the commas out of the square brackets, they are no longer optional. For example, to call the function below with only a string:</p> <pre><code>Re...
2
2010-01-22T21:09:27Z
[ "python", "documentation", "notation" ]
Why do Python function docs include the comma after the bracket for optional args?
2,120,507
<p>The format of the function signatures in the Python docs is a bit confusing. What is the significance in putting the comma after the open bracket, rather than before? What is the significance of nesting the brackets?</p> <p>How they are:</p> <pre><code>RegexObject.match(string[, pos[, endpos]]) </code></pre> <p...
4
2010-01-22T21:06:36Z
2,120,531
<p>If you think about the brackets enclosing all optional components of the argument list, it makes more sense. Essentially, anything inside brackets may be left out at the discretion of the user.</p>
0
2010-01-22T21:10:52Z
[ "python", "documentation", "notation" ]
Why do Python function docs include the comma after the bracket for optional args?
2,120,507
<p>The format of the function signatures in the Python docs is a bit confusing. What is the significance in putting the comma after the open bracket, rather than before? What is the significance of nesting the brackets?</p> <p>How they are:</p> <pre><code>RegexObject.match(string[, pos[, endpos]]) </code></pre> <p...
4
2010-01-22T21:06:36Z
2,120,535
<p>The brackets mean that you can leave out the part between them. So if the docs would be written the way you suggest, it would imply that you can write RegexObject.match(string,,) by leaving everything in brackets. Or RegexObject.match(string,,endpos) by just leaving out the second one. But you can't. If you leave ou...
0
2010-01-22T21:11:03Z
[ "python", "documentation", "notation" ]
What side effects should one expect when method decorator replaces self?
2,120,563
<p>I want to execute a method with a copy of the original <code>self</code> passed while execution.</p> <p>Here is the code I'm talking about:</p> <pre><code>def protect_self(func): from copy import copy from functools import wraps @wraps(func) def decorated(self, *args, **kwargs): self_copy =...
0
2010-01-22T21:14:05Z
2,120,605
<p>The copy makes it so the 'self' passed to the decorated function is a shallow copy of the original. The decorated function can't modify the original 'self' directly, although it can of course modify it through other means (if it has indirect access to it.) If any of the attributes of the object are mutable, it can e...
2
2010-01-22T21:20:26Z
[ "python", "decorator", "self" ]
What side effects should one expect when method decorator replaces self?
2,120,563
<p>I want to execute a method with a copy of the original <code>self</code> passed while execution.</p> <p>Here is the code I'm talking about:</p> <pre><code>def protect_self(func): from copy import copy from functools import wraps @wraps(func) def decorated(self, *args, **kwargs): self_copy =...
0
2010-01-22T21:14:05Z
2,121,958
<p>As the OP clarified in a comment that the purpose is to be threadsafe, then there's an obvious issue -- <code>copy.copy</code> itself <strong>isn't</strong> threadsafe, in addition to the issue already pointed out, that <code>copy.copy</code> makes a <strong>shallow</strong> copy and so (while <code>self.__dict__</c...
1
2010-01-23T03:24:37Z
[ "python", "decorator", "self" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
2,201,828
<p><strong>UPDATE:</strong> Since Django 1.8, this is built in.</p> <p>See <a href="http://stackoverflow.com/a/28170958/493272">this answer</a> and <a href="https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.show_change_link" rel="nofollow">the official documentation</a>.</p...
27
2010-02-04T17:34:26Z
[ "python", "django", "django-admin" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
8,061,891
<p>Did you try the <a href="https://docs.djangoproject.com/en/dev/ref/contrib/admin/#reversing-admin-urls" rel="nofollow">Reversing admin URL</a> system ?<br> That could give something like that (in the journal page):</p> <pre><code>&lt;ul&gt; {% for volume in original.volume_set.all %} &lt;li&gt; &lt;a href="{%...
3
2011-11-09T07:58:54Z
[ "python", "django", "django-admin" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
9,452,596
<p>Keep your code in <strong>models.py</strong> with conditional case:</p> <pre><code>def selflink(self): if self.id: return "&lt;a href='/link/to/volume/%s' target='_blank'&gt;Edit&lt;/a&gt;" % str(self.id) else: return "Not present" selflink.allow_tags = True </code></pre> <p>In <strong>adm...
25
2012-02-26T11:14:08Z
[ "python", "django", "django-admin" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
14,046,844
<p>After some fiddling, I was able to make this work in an InlineAdmin and a TabularInline, using reverse(). At least with TabularInline, the field you want to link <em>must</em> be listed in 'readonly_fields'</p> <pre><code># create a read-only inline with the first field linked from django.core import urlresolvers c...
2
2012-12-26T22:09:08Z
[ "python", "django", "django-admin" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
21,079,750
<p>Here's a reusable mixin based on some of the other answers. This is handy because it works with both Tabular and Stacked inlines, and doesn't cruft up your model or admin code.</p> <pre><code># put this somewhere like admin_helpers.py from django.core.urlresolvers import reverse class InlineEditLinkMixin(object): ...
13
2014-01-12T20:14:24Z
[ "python", "django", "django-admin" ]
Django InlineModelAdmin: Show partially an inline model and link to the complete model
2,120,813
<p>Hi everybody I defined several models: Journals, volumes, volume_scanInfo etc.</p> <p>A journal can have more volumes and a volume can have more scanInfo.</p> <p>What I want to do is:</p> <ul> <li>in the admin page of journals I want to have the list of the volumes inline (done)</li> <li>connect each volume of th...
29
2010-01-22T21:53:14Z
31,895,920
<p>In <a href="https://docs.djangoproject.com/en/1.8/ref/contrib/admin/#django.contrib.admin.InlineModelAdmin.show_change_link">Django 1.8+ this is now much easier</a>. Just add <code>show_change_link = True</code> to your <code>TabularInline</code> or <code>StackedInline</code> subclass, like this: </p> <pre><code>cl...
6
2015-08-08T16:07:08Z
[ "python", "django", "django-admin" ]
Can someone help clarify my confusion about syncdb and import loops, 'Do you have to be explicit on imports?'
2,120,870
<p>I have been having a difficult time building the database with syncdb on Python2.5. I think that some of this issue is because of the use of wildcard* for importing forum.models it seems to be creating a loop.</p> <pre><code>&gt;&gt;&gt; import settings &gt;&gt;&gt; from forum.managers import QuestionManager, Tag...
2
2010-01-22T22:01:50Z
2,122,647
<p>Would you happen to be using <code>global_settings.py</code> or <code>local_settings.py</code> in addition to <code>settings.py</code>?</p> <p>The proper way to import Django's settings is to use the decoupled object <code>from django.conf import settings</code>, NOT to <code>import settings</code>. See the doc pa...
0
2010-01-23T08:47:46Z
[ "python", "django", "django-syncdb" ]
Inline parsing in BeautifulSoup in Python
2,121,036
<p>I am writing an HTML document with BeautifulSoup, and I would like it to not split inline text (such as text within the <code>&lt;p&gt;</code> tag) into multiple lines. The issue that I get is that parsing the <code>&lt;p&gt;a&lt;span&gt;b&lt;/span&gt;c&lt;/p&gt;</code> with prettify gives me the output </p> <pre><...
0
2010-01-22T22:35:24Z
2,121,219
<p>How about not using <code>prettify</code> at all?</p> <pre><code>BeautifulSoup.BeautifulSoup('&lt;p&gt;a&lt;span&gt;b&lt;/span&gt;c&lt;/p&gt;').renderContents() </code></pre> <p>outputs the original HTML with no extra spaces. You can use e.g. Firebug to have a closer look at the document's structure later with no ...
2
2010-01-22T23:16:15Z
[ "python", "beautifulsoup", "html" ]
Inline parsing in BeautifulSoup in Python
2,121,036
<p>I am writing an HTML document with BeautifulSoup, and I would like it to not split inline text (such as text within the <code>&lt;p&gt;</code> tag) into multiple lines. The issue that I get is that parsing the <code>&lt;p&gt;a&lt;span&gt;b&lt;/span&gt;c&lt;/p&gt;</code> with prettify gives me the output </p> <pre><...
0
2010-01-22T22:35:24Z
2,121,936
<p>I'd just do:</p> <pre><code>from BeautifulSoup import BeautifulSoup ht = '&lt;p&gt;a&lt;span&gt;b&lt;/span&gt;c&lt;/p&gt;' soup = BeautifulSoup(ht) print soup </code></pre> <p>and avoid getting any extra whitespace. <code>prettify</code>'s job is exactly to adjust whitespace to clearly show the HTML parse tree's...
0
2010-01-23T03:17:18Z
[ "python", "beautifulsoup", "html" ]
How do I get stacktraces from epydoc when it is loading my code?
2,121,268
<p>When I load my code into <code>epydoc</code> and just load the top module it fails with:</p> <pre><code>Error: TypeError: 'NoneType' object is not callable (line 10) </code></pre> <p>Where the the <code>NoneType</code> that it is referring to is a submodule that I tried to load on line 9. How can I get epydoc to ...
1
2010-01-22T23:29:08Z
2,121,624
<p>So if I understand correctly, the module you're running epydoc on imports a module that has an error in it (not the module you want to generate docs for)? </p> <p>If all you need to accomplish is to see the line in the file which has the error so you can debug it, you can pass in this file as well and the line num...
2
2010-01-23T01:08:59Z
[ "python", "epydoc" ]
Why does this code have the "ball" seem to slide along the edge
2,121,287
<p>My son asked me if I could write a small program to have a ball bounce around the screen then have me explain it. Spotting a neat father-son opportunity I said "Yes!, no problem". So I dug out my python skills and wrote this..</p> <pre><code>#!/usr/bin/python # # We have to tell python what stuff we're # going to ...
4
2010-01-22T23:34:42Z
2,121,304
<p>You need to add twice dir_* in the "change direction" code. </p>
10
2010-01-22T23:37:43Z
[ "python" ]
Why does this code have the "ball" seem to slide along the edge
2,121,287
<p>My son asked me if I could write a small program to have a ball bounce around the screen then have me explain it. Spotting a neat father-son opportunity I said "Yes!, no problem". So I dug out my python skills and wrote this..</p> <pre><code>#!/usr/bin/python # # We have to tell python what stuff we're # going to ...
4
2010-01-22T23:34:42Z
2,121,306
<p>Not really too familiar with python, but is</p> <pre><code>dir_x = -dir_x </code></pre> <p>Acceptable? Maybe try</p> <pre><code>dir_x *= -1 </code></pre> <p>or</p> <pre><code>dir_x = dir_x * -1 </code></pre> <p>?</p>
-2
2010-01-22T23:38:03Z
[ "python" ]
Why does this code have the "ball" seem to slide along the edge
2,121,287
<p>My son asked me if I could write a small program to have a ball bounce around the screen then have me explain it. Spotting a neat father-son opportunity I said "Yes!, no problem". So I dug out my python skills and wrote this..</p> <pre><code>#!/usr/bin/python # # We have to tell python what stuff we're # going to ...
4
2010-01-22T23:34:42Z
2,121,343
<p>You are figuring out a new x and y coordinate before you are testing. So, say the ball is at 20, 1 and is drawn, and assume the dir is North East with slope 1. The next position will be calculated at 21, 0. Here you see the y is out of range now. So you set it back to 1 when what you really want is 2, so you get...
4
2010-01-22T23:47:13Z
[ "python" ]
Why does this code have the "ball" seem to slide along the edge
2,121,287
<p>My son asked me if I could write a small program to have a ball bounce around the screen then have me explain it. Spotting a neat father-son opportunity I said "Yes!, no problem". So I dug out my python skills and wrote this..</p> <pre><code>#!/usr/bin/python # # We have to tell python what stuff we're # going to ...
4
2010-01-22T23:34:42Z
2,121,365
<p>Getting this kind of simulation to work properly at the edges is tricky. I ran it here and it looks nice to me (OS X). When it hits the edge you'll get two O's in a row at the edge but then it comes back. At a guess, this has to do with how far your virtual x,y point has to penetrate before reversal happens, whic...
0
2010-01-22T23:53:32Z
[ "python" ]
Why does this code have the "ball" seem to slide along the edge
2,121,287
<p>My son asked me if I could write a small program to have a ball bounce around the screen then have me explain it. Spotting a neat father-son opportunity I said "Yes!, no problem". So I dug out my python skills and wrote this..</p> <pre><code>#!/usr/bin/python # # We have to tell python what stuff we're # going to ...
4
2010-01-22T23:34:42Z
2,322,303
<p>Took me a while to work out what you're meaning. You mean the double 'OO' on the wall when it changes direction? Seems to me the conditional allows the ball to go over (not up to) the line and then pulls it back again. I changed this bit:</p> <pre><code># have we gone too far if x &gt;= max_x or x &lt;= min_x: ...
0
2010-02-23T22:39:38Z
[ "python" ]
Python3 http.server POST example
2,121,481
<p>I'm converting a Python2.6 app into a Python3 app and I'm getting stuck with the server. I've managed to get it serving up GET requests just fine but POST continues to elude me. Here is what I started with in 2.6 that worked but in 3.x the normal server does not handle POST requests. From my reading of the Python ma...
13
2010-01-23T00:29:38Z
2,124,520
<p>After poking and a few more hours of googling I've found the following works.</p> <pre><code>def do_POST(self): length = int(self.headers['Content-Length']) post_data = urllib.parse.parse_qs(self.rfile.read(length).decode('utf-8')) # You now have a dictionary of the post data self.wfile.write("Lore...
10
2010-01-23T20:11:22Z
[ "python", "python-3.x" ]
How to report a bug with Python's 'help()' function?
2,121,715
<p>As a hobby/learning project, I'm writing a parser generator in Python. One of my code files is named "token.py" - which contains a couple of classes for turning plain strings into Token objects. I've just discovered that using the "help()" function from the console in Python raises an error for any module defined in...
1
2010-01-23T01:39:20Z
2,121,746
<p>You can search for issues and report new ones here: <a href="http://bugs.python.org/" rel="nofollow">http://bugs.python.org/</a>. </p>
1
2010-01-23T01:56:20Z
[ "python", "namespaces" ]
How to report a bug with Python's 'help()' function?
2,121,715
<p>As a hobby/learning project, I'm writing a parser generator in Python. One of my code files is named "token.py" - which contains a couple of classes for turning plain strings into Token objects. I've just discovered that using the "help()" function from the console in Python raises an error for any module defined in...
1
2010-01-23T01:39:20Z
2,121,758
<p>The problem is that your local <code>token.py</code> is being imported by <code>help()</code> instead of Python's actual <code>token.py</code>. This will occur for any number of <code>.py</code> files whose names collide with built-in modules. For example, try creating a <code>pydoc.py</code> file in the CWD and the...
5
2010-01-23T01:59:58Z
[ "python", "namespaces" ]
How to report a bug with Python's 'help()' function?
2,121,715
<p>As a hobby/learning project, I'm writing a parser generator in Python. One of my code files is named "token.py" - which contains a couple of classes for turning plain strings into Token objects. I've just discovered that using the "help()" function from the console in Python raises an error for any module defined in...
1
2010-01-23T01:39:20Z
2,121,779
<p>This isn't a bug with the the help() method. There is a module in the standard library named <em>token.py</em> which is imported by <em>tokenize.py</em> (where the error you're seeing originates from).</p> <p>from tokenize.py:</p> <pre><code>from token import * </code></pre> <p>So tokenize.py expects to have a b...
0
2010-01-23T02:07:17Z
[ "python", "namespaces" ]
How to report a bug with Python's 'help()' function?
2,121,715
<p>As a hobby/learning project, I'm writing a parser generator in Python. One of my code files is named "token.py" - which contains a couple of classes for turning plain strings into Token objects. I've just discovered that using the "help()" function from the console in Python raises an error for any module defined in...
1
2010-01-23T01:39:20Z
2,121,887
<p>Whenever you choose to name your modules in a way that mimics module names defined in Python's standard library, you're fully responsible for whatever happens as a result -- other Python standard library modules are likely to rely on those that you are hiding/overriding, and if your own modules don't carefully mimic...
3
2010-01-23T02:59:02Z
[ "python", "namespaces" ]
Interacting with a verified location? - Google Maps
2,121,780
<p>Ok so there are loads of <strong>Businesses marked on Google Maps</strong> these days.</p> <p>But I cannot interact with these in any way.</p> <p>This is the information I have:</p> <blockquote> <p>venue name: <strong>Ministry of Sound</strong></p> <p>address: <strong>103 Gaunt Street London, SE1 6DP</stro...
5
2010-01-23T02:08:52Z
2,134,059
<p>I think there is a certain confusion here. The main reason that you cannot interact with this information and for the lack of API is because none of these things (reviews, photos, videos, other content) is actually owned by Google. Google just indexes and aggregates information from the sites like Qype, ViewLondon, ...
1
2010-01-25T17:11:24Z
[ "javascript", "python", "django", "google-maps" ]
Interacting with a verified location? - Google Maps
2,121,780
<p>Ok so there are loads of <strong>Businesses marked on Google Maps</strong> these days.</p> <p>But I cannot interact with these in any way.</p> <p>This is the information I have:</p> <blockquote> <p>venue name: <strong>Ministry of Sound</strong></p> <p>address: <strong>103 Gaunt Street London, SE1 6DP</stro...
5
2010-01-23T02:08:52Z
2,134,215
<p>The Google product of local business entries you are referring to is called "Local Business Cent[<a href="http://www.google.com/local/add/?gl=US" rel="nofollow">er</a>|<a href="http://www.google.com/local/add/?gl=GB" rel="nofollow">re</a>]". As far as I know, there is no API to access and manipulate these entries *....
0
2010-01-25T17:31:03Z
[ "javascript", "python", "django", "google-maps" ]
Interacting with a verified location? - Google Maps
2,121,780
<p>Ok so there are loads of <strong>Businesses marked on Google Maps</strong> these days.</p> <p>But I cannot interact with these in any way.</p> <p>This is the information I have:</p> <blockquote> <p>venue name: <strong>Ministry of Sound</strong></p> <p>address: <strong>103 Gaunt Street London, SE1 6DP</stro...
5
2010-01-23T02:08:52Z
2,134,429
<p>You probably would have to get in touch with Google to let them know about your site and get them to include your reviews in their maps. Have a look at <a href="http://www.google.com/submityourcontent/index.html" rel="nofollow">this</a> and <a href="http://maps.google.com/support/bin/request.py?contact_type=partner&...
1
2010-01-25T18:03:41Z
[ "javascript", "python", "django", "google-maps" ]
Interacting with a verified location? - Google Maps
2,121,780
<p>Ok so there are loads of <strong>Businesses marked on Google Maps</strong> these days.</p> <p>But I cannot interact with these in any way.</p> <p>This is the information I have:</p> <blockquote> <p>venue name: <strong>Ministry of Sound</strong></p> <p>address: <strong>103 Gaunt Street London, SE1 6DP</stro...
5
2010-01-23T02:08:52Z
2,136,282
<p>In response to your edited question: </p> <p>You should look at microformats like <a href="http://microformats.org/wiki/hreview" rel="nofollow">hReview</a>, Google indexes and uses these in search results if not on the page you linked to. See: <a href="http://googlewebmastercentral.blogspot.com/2009/05/introducing-...
2
2010-01-25T22:49:48Z
[ "javascript", "python", "django", "google-maps" ]
rstrip not removing newline char what am I doing wrong?
2,121,839
<p>Pulling my hair out here... have been playing around with this for the last hour but I cannot get it to do what I want, ie. remove the newline sequence. </p> <pre><code>def add_quotes( fpath ): ifile = open( fpath, 'r' ) ofile = open( 'ofile.txt', 'w' ) for line in ifile: if l...
9
2010-01-23T02:32:27Z
2,121,843
<p>The clue is in the signature of <code>rstrip</code>.</p> <p>It returns a copy of the string, but with the desired characters stripped, thus you'll need to assign <code>line</code> the new value:</p> <pre><code>line = line.rstrip('\n') </code></pre> <p>This allows for the sometimes very handy chaining of operation...
13
2010-01-23T02:36:14Z
[ "python", "newline" ]
rstrip not removing newline char what am I doing wrong?
2,121,839
<p>Pulling my hair out here... have been playing around with this for the last hour but I cannot get it to do what I want, ie. remove the newline sequence. </p> <pre><code>def add_quotes( fpath ): ifile = open( fpath, 'r' ) ofile = open( 'ofile.txt', 'w' ) for line in ifile: if l...
9
2010-01-23T02:32:27Z
2,121,854
<p>you can do it like this</p> <pre><code>def add_quotes( fpath ): ifile = open( fpath, 'r' ) ofile = open( 'ofile.txt', 'w' ) for line in ifile: line=line.rstrip() convertedline = '"' + line + '", ' ofile.write( convertedline + "\n" ) ifile.close() ...
3
2010-01-23T02:40:10Z
[ "python", "newline" ]
rstrip not removing newline char what am I doing wrong?
2,121,839
<p>Pulling my hair out here... have been playing around with this for the last hour but I cannot get it to do what I want, ie. remove the newline sequence. </p> <pre><code>def add_quotes( fpath ): ifile = open( fpath, 'r' ) ofile = open( 'ofile.txt', 'w' ) for line in ifile: if l...
9
2010-01-23T02:32:27Z
2,121,855
<p>As alluded to in Skurmedel's answer and the comments, you need to do something like:</p> <pre><code>stripped_line = line.rstrip() </code></pre> <p>and then write out stripped_line.</p>
2
2010-01-23T02:41:36Z
[ "python", "newline" ]
Python pickling after changing a module's directory
2,121,874
<p>I've recently changed my program's directory layout: before, I had all my modules inside the "main" folder. Now, I've moved them into a directory named after the program, and placed an <code>__init__.py</code> there to make a package.</p> <p>Now I have a single .py file in my main directory that is used to launch m...
15
2010-01-23T02:52:39Z
2,121,886
<p>This is the normal behavior of pickle, unpickled objects need to have their <a href="http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled" rel="nofollow">defining module importable</a>.</p> <p>You should be able to change the modules path (i.e. from <code>tools</code> to <code>whyteboard.too...
1
2010-01-23T02:58:53Z
[ "python", "pickle" ]
Python pickling after changing a module's directory
2,121,874
<p>I've recently changed my program's directory layout: before, I had all my modules inside the "main" folder. Now, I've moved them into a directory named after the program, and placed an <code>__init__.py</code> there to make a package.</p> <p>Now I have a single .py file in my main directory that is used to launch m...
15
2010-01-23T02:52:39Z
2,121,918
<p>As <a href="http://docs.python.org/library/pickle.html?highlight=pickle#relationship-to-other-python-modules">pickle's docs</a> say, in order to save and restore a class instance (actually a function, too), you must respect certain constraints:</p> <blockquote> <p>pickle can save and restore class instances tra...
25
2010-01-23T03:11:03Z
[ "python", "pickle" ]
Python pickling after changing a module's directory
2,121,874
<p>I've recently changed my program's directory layout: before, I had all my modules inside the "main" folder. Now, I've moved them into a directory named after the program, and placed an <code>__init__.py</code> there to make a package.</p> <p>Now I have a single .py file in my main directory that is used to launch m...
15
2010-01-23T02:52:39Z
25,244,948
<p><code>pickle</code> serializes classes by reference, so if you change were the class lives, it will not unpickle because the class will not be found. If you use <code>dill</code> instead of <code>pickle</code>, then you can serialize classes by reference or directly (by directly serializing the class instead of it'...
2
2014-08-11T13:52:24Z
[ "python", "pickle" ]
Word wrap on report lab PDF table
2,121,909
<p>I'm using the Table of Report Lab library to print a table on a PDF report. I would like to know if it's possible to configure the table to perform an automatic wrapping of the content of a cell. </p> <p>For example, I have a text that doesn't fit on a cell inside a column. I would like that the table performs the ...
11
2010-01-23T03:05:58Z
2,123,359
<p>You can put any flowable in a table element. It is probably good practice to have all table elements as flowables, so they can be styled the same. For your case you will most likely need a Paragraph flowable. eg.</p> <pre><code>styles = getSampleStyleSheet() text = Paragraph("long line", styles['Nor...
11
2010-01-23T13:56:08Z
[ "python", "reportlab" ]
Word wrap on report lab PDF table
2,121,909
<p>I'm using the Table of Report Lab library to print a table on a PDF report. I would like to know if it's possible to configure the table to perform an automatic wrapping of the content of a cell. </p> <p>For example, I have a text that doesn't fit on a cell inside a column. I would like that the table performs the ...
11
2010-01-23T03:05:58Z
5,276,536
<p>My solution, force newline in the string:</p> <pre><code>def __chopLine(line, maxline): cant = len(line) / maxline cant += 1 strline = "" index = maxline for i in range(1,cant): index = maxline * i strline += "%s\n" %(line[(index-maxline):index]) strline += "%s\n" %(line[ind...
1
2011-03-11T17:54:18Z
[ "python", "reportlab" ]
Word wrap on report lab PDF table
2,121,909
<p>I'm using the Table of Report Lab library to print a table on a PDF report. I would like to know if it's possible to configure the table to perform an automatic wrapping of the content of a cell. </p> <p>For example, I have a text that doesn't fit on a cell inside a column. I would like that the table performs the ...
11
2010-01-23T03:05:58Z
16,870,929
<p>*whole code of word wrap</p> <pre><code>from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import A4 from reportlab.lib.styles import getSampleStyleSheet from reportlab.platypus import Paragraph, Table, TableStyle from reportlab.lib.enums import TA_JUSTIFY, TA_LEFT, TA_CENTER from reportlab.lib import...
2
2013-06-01T08:54:16Z
[ "python", "reportlab" ]
Python: urllib2 or Pycurl?
2,121,945
<p>I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library.</p> <p>My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2.</p> <p>Putting aside my previou...
2
2010-01-23T03:20:58Z
2,121,967
<p><code>urllib2</code> is part of the standard library, <code>pycurl</code> isn't (so it requires a separate step of download/install/package etc). That alone, quite apart from any difference in intrinsic quality, is guaranteed to make <code>urllib2</code> more popular (and can be a pretty good pragmatical reason to ...
3
2010-01-23T03:26:31Z
[ "python", "urllib2", "pycurl" ]
Python: urllib2 or Pycurl?
2,121,945
<p>I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library.</p> <p>My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2.</p> <p>Putting aside my previou...
2
2010-01-23T03:20:58Z
2,121,976
<p>CURL has a lot more features as stated in its <a href="http://pycurl.sourceforge.net/">web page</a>, so if you need, say fast concurrent connections, safe threading, etc then its for you. However, its not included in the distribution. If you foresee that your task is very simple, then use urllib2 and those HTTP modu...
8
2010-01-23T03:29:38Z
[ "python", "urllib2", "pycurl" ]
Python: urllib2 or Pycurl?
2,121,945
<p>I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library.</p> <p>My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2.</p> <p>Putting aside my previou...
2
2010-01-23T03:20:58Z
2,122,198
<p>Use urllib2. It's got very good documentation in python, while pycurl is mostly C documentation. If you hit a wall, switch to mechanize or pycurl. </p>
1
2010-01-23T05:06:34Z
[ "python", "urllib2", "pycurl" ]
Python: urllib2 or Pycurl?
2,121,945
<p>I have extensive experience with PHP cURL but for the last few months I've been coding primarily in Java, utilizing the HttpClient library.</p> <p>My new project requires me to use Python, once again putting me at the crossroads of seemingly comparable libraries: pycurl and urllib2.</p> <p>Putting aside my previou...
2
2010-01-23T03:20:58Z
9,016,637
<p>Nowadays there are other excellent alternatives - <a href="http://urllib3.readthedocs.org/" rel="nofollow">urllib3</a> and <a href="http://docs.python-requests.org/" rel="nofollow">requests</a></p>
3
2012-01-26T10:19:09Z
[ "python", "urllib2", "pycurl" ]
Trouble using python's gzip/"How do I know what compression is being used?"
2,122,190
<p>Ok, so I've got an Open Source Java client/server program that uses packets to communicate. I'm trying to write a python client for said program, but the contents of the packet seem to be compressed. A quick perusal through the source code suggested gzip as the compression schema (since that was the only compression...
0
2010-01-23T05:01:35Z
2,122,216
<p>You could try using standard library module <a href="http://docs.python.org/library/zlib.html?highlight=zlib#module-zlib" rel="nofollow">zlib</a> directly -- that's what <a href="http://docs.python.org/library/gzip.html?highlight=gzip#module-gzip" rel="nofollow">gzip</a> uses for the compress/decompress part. If th...
1
2010-01-23T05:12:20Z
[ "java", "python", "reverse-engineering", "decompression" ]
Trouble using python's gzip/"How do I know what compression is being used?"
2,122,190
<p>Ok, so I've got an Open Source Java client/server program that uses packets to communicate. I'm trying to write a python client for said program, but the contents of the packet seem to be compressed. A quick perusal through the source code suggested gzip as the compression schema (since that was the only compression...
0
2010-01-23T05:01:35Z
2,122,262
<p>It's likely to be compliant with one of RFC <a href="http://tools.ietf.org/html/rfc1950" rel="nofollow">1950</a>, <a href="http://tools.ietf.org/html/rfc1951" rel="nofollow">1951</a>, or <a href="http://tools.ietf.org/html/rfc1952" rel="nofollow">1952</a>. </p> <p>Since the name is GZIP, I'd first check 1952. Then...
0
2010-01-23T05:34:41Z
[ "java", "python", "reverse-engineering", "decompression" ]
Trouble using python's gzip/"How do I know what compression is being used?"
2,122,190
<p>Ok, so I've got an Open Source Java client/server program that uses packets to communicate. I'm trying to write a python client for said program, but the contents of the packet seem to be compressed. A quick perusal through the source code suggested gzip as the compression schema (since that was the only compression...
0
2010-01-23T05:01:35Z
2,123,247
<p>It would help enormously if you divulged:</p> <p>(0) What leads you to the conclusion that "the contents of the packet seem to be compressed"</p> <p>(1) The URLs for the (a) source and (b) documentation of the package that is writing the packets</p> <p>(2) The contents of a sample packet</p> <p>(a) <code>print r...
1
2010-01-23T13:19:11Z
[ "java", "python", "reverse-engineering", "decompression" ]
What are some Pythonic ways to share variables with objects defined in a module?
2,122,306
<p>I'm building a module where there are a whole lot of diverse objects which need to be controlled by several variables.</p> <p>If this were C, I would pass the objects a pointer to the variable / object I want them to watch, have the application change the variable as it needs to, and the objects in the module would...
3
2010-01-23T05:57:04Z
2,122,329
<p>How about putting the control variables in a separate module -- say, <code>settings</code> -- and doing a separate <code>import settings</code>? You could then have your objects watch <code>settings.bar</code> and <code>settings.quux</code> while still doing <code>from foo import *</code> to clutter up your main nam...
3
2010-01-23T06:07:42Z
[ "python", "module", "global-variables" ]
What are some Pythonic ways to share variables with objects defined in a module?
2,122,306
<p>I'm building a module where there are a whole lot of diverse objects which need to be controlled by several variables.</p> <p>If this were C, I would pass the objects a pointer to the variable / object I want them to watch, have the application change the variable as it needs to, and the objects in the module would...
3
2010-01-23T05:57:04Z
2,122,331
<p>The trick is to use a mutable type. Strings are immutable, so when you change the string, it creates a new string object in a new memory space. If, however, you referenced a list and appended to the list, the memory space won't change. Adapting your code...</p> <pre><code>&gt;&gt;&gt; class Foo(object): ... ...
3
2010-01-23T06:08:00Z
[ "python", "module", "global-variables" ]
What are some Pythonic ways to share variables with objects defined in a module?
2,122,306
<p>I'm building a module where there are a whole lot of diverse objects which need to be controlled by several variables.</p> <p>If this were C, I would pass the objects a pointer to the variable / object I want them to watch, have the application change the variable as it needs to, and the objects in the module would...
3
2010-01-23T05:57:04Z
2,122,334
<p>Your problem here is that in C variables are data are objects. In Python, variables are always references to objects (which are data). You can easily watch an object, but not a variable. For example, <code>x = "after"</code> actually "unlinks" the object <code>before</code> from <code>x</code> and links a new object...
1
2010-01-23T06:09:14Z
[ "python", "module", "global-variables" ]
What are some Pythonic ways to share variables with objects defined in a module?
2,122,306
<p>I'm building a module where there are a whole lot of diverse objects which need to be controlled by several variables.</p> <p>If this were C, I would pass the objects a pointer to the variable / object I want them to watch, have the application change the variable as it needs to, and the objects in the module would...
3
2010-01-23T05:57:04Z
2,122,342
<p>To catch all re-bindings of a name, you need to pass both a namespace <em>and</em> a specific name to use as the key within it. Using a dedicated <code>dict</code> as the namespace is fine, but the <code>dict</code> for the whole module (which you can get as <code>globals()</code>) or for any specific object <code>...
3
2010-01-23T06:12:21Z
[ "python", "module", "global-variables" ]
What are some Pythonic ways to share variables with objects defined in a module?
2,122,306
<p>I'm building a module where there are a whole lot of diverse objects which need to be controlled by several variables.</p> <p>If this were C, I would pass the objects a pointer to the variable / object I want them to watch, have the application change the variable as it needs to, and the objects in the module would...
3
2010-01-23T05:57:04Z
2,123,276
<p>In a comment to Alex Martelli's solution, tbroberg asks, "What if the parties agree to use the namespace of the module? How can the application get the module's namespace?"</p> <p>Here is how you could set the namespace (by default) to be the caller's namespace:</p> <pre><code>import inspect class foo(object): ...
1
2010-01-23T13:30:50Z
[ "python", "module", "global-variables" ]
Dynamic terminal printing with python
2,122,385
<p>Certain applications like hellanzb have a way of printing to the terminal with the appearance of dynamically refreshing data, kind of like top().</p> <p>Whats the best method in python for doing this? I have read up on logging and curses, but don't know what to use. I am creating a reimplementation of top. If yo...
16
2010-01-23T06:33:29Z
2,122,421
<p>When I do this in shell scripts on Unix, I tend to just use the clear program. You can use the Python subprocess module to execute it. It will at least get you what you're looking for quickly.</p>
0
2010-01-23T06:47:33Z
[ "python", "terminal" ]
Dynamic terminal printing with python
2,122,385
<p>Certain applications like hellanzb have a way of printing to the terminal with the appearance of dynamically refreshing data, kind of like top().</p> <p>Whats the best method in python for doing this? I have read up on logging and curses, but don't know what to use. I am creating a reimplementation of top. If yo...
16
2010-01-23T06:33:29Z
2,122,422
<pre><code>[ignacio@localhost ~]$ ldd /usr/bin/top | grep curses libncursesw.so.5 =&gt; /lib64/libncursesw.so.5 (0x0000003ae1400000) </code></pre> <p><a href="http://docs.python.org/library/curses.html" rel="nofollow"><code>curses</code></a> it is.</p>
0
2010-01-23T06:48:40Z
[ "python", "terminal" ]
Dynamic terminal printing with python
2,122,385
<p>Certain applications like hellanzb have a way of printing to the terminal with the appearance of dynamically refreshing data, kind of like top().</p> <p>Whats the best method in python for doing this? I have read up on logging and curses, but don't know what to use. I am creating a reimplementation of top. If yo...
16
2010-01-23T06:33:29Z
2,122,430
<p>Sounds like a job for <code>curses</code>. It is the most commonly used library for text-mode screen layout and management. Python has very good support for curses, including support for panels:</p> <ul> <li><a href="http://docs.python.org/library/curses.html" rel="nofollow">http://docs.python.org/library/curses.h...
2
2010-01-23T06:51:57Z
[ "python", "terminal" ]
Dynamic terminal printing with python
2,122,385
<p>Certain applications like hellanzb have a way of printing to the terminal with the appearance of dynamically refreshing data, kind of like top().</p> <p>Whats the best method in python for doing this? I have read up on logging and curses, but don't know what to use. I am creating a reimplementation of top. If yo...
16
2010-01-23T06:33:29Z
2,122,972
<p>The simplest way, if you only ever need to update a single line (for instance, creating a progress bar), is to use <code>'\r'</code> (carriage return) and <code>sys.stdout</code>:</p> <pre><code>import sys import time for i in range(10): sys.stdout.write("\r{0}&gt;".format("="*i)) sys.stdout.flush() ti...
23
2010-01-23T11:31:21Z
[ "python", "terminal" ]