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 listlengths 1 5 |
|---|---|---|---|---|---|---|---|---|---|
Python library for converting files to MP3 and setting their quality | 1,246,131 | <p>I'm trying to find a Python library that would take an audio file (e.g. .ogg, .wav) and convert it into mp3 for playback on a webpage. </p>
<p>Also, any thoughts on setting its quality for playback would be great.</p>
<p>Thank you.</p>
| 8 | 2009-08-07T17:51:39Z | 12,391,523 | <p>I wrote <a href="http://pydub.com" rel="nofollow">a library</a> designed to do that =D </p>
<pre><code>from pydub import AudioSegment
AudioSegment.from_file("/input/file").export("/output/file", format="mp3")
</code></pre>
<p>Easy!</p>
<p>to specify a bitrate, just use the <code>bitrate</code> kwargâ¦</p>
<pre>... | 12 | 2012-09-12T15:23:23Z | [
"python",
"audio",
"compression"
] |
Python/mySQL on an Embedded ARM9 Device? | 1,246,235 | <p>I have an application where a small embedded ARM9 device (running Linux) must gather information from sensors and then connect to a remote mySQL database and INSERT the data. I have Python 2.5 running on the ARM9 device fine. I have developed a prototype application in Python 2.5 running on x86 Windows and it connec... | 0 | 2009-08-07T18:12:49Z | 1,246,261 | <p>It should compile on ARM just fine, but first you should check that your platform's Linux distribution doesn't simply have packages for MySQL (if it has packages, it probably has those). If there are no packages it should be no big deal to compile it yourself. How's your cross compiler? Or is the platform big enough... | 1 | 2009-08-07T18:18:50Z | [
"python",
"arm",
"embedded"
] |
Python/mySQL on an Embedded ARM9 Device? | 1,246,235 | <p>I have an application where a small embedded ARM9 device (running Linux) must gather information from sensors and then connect to a remote mySQL database and INSERT the data. I have Python 2.5 running on the ARM9 device fine. I have developed a prototype application in Python 2.5 running on x86 Windows and it connec... | 0 | 2009-08-07T18:12:49Z | 4,729,963 | <p>I suggest using SQLite. I have an application running Python+SQLite for telemetry purposes and it works like a charm. It's much easier than MySQL.</p>
| 0 | 2011-01-18T22:49:17Z | [
"python",
"arm",
"embedded"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,246,470 | <p>Do you mean this?</p>
<pre><code>>>> dict( (n,int(v)) for n,v in (a.split('=') for a in string.split() ) )
{'a': 0, 'c': 3, 'b': 1}
</code></pre>
| 27 | 2009-08-07T19:07:15Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,246,585 | <pre><code>from cgi import parse_qsl
text = "a=0 b=1 c=3"
dic = dict((k, int(v)) for k, v in parse_qsl(text.replace(' ', '&')))
print dic
</code></pre>
<p>prints</p>
<pre><code>{'a': 0, 'c': 3, 'b': 1}
</code></pre>
| 1 | 2009-08-07T19:32:29Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,247,057 | <p>I like S.Lott's solution, but I came up with another possibility.<br />
Since you already have a string resembling somehow the way you'd write that, you can just adapt it to python syntax and then eval() it :)</p>
<pre><code>import re
string = "a=0 b=1 c=3"
string2 = "{"+ re.sub('( |^)(?P<id>\w+)=(?P<val&g... | -3 | 2009-08-07T21:16:37Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,247,741 | <p>How about a one-liner without list comprehension?</p>
<pre><code> foo="a=0 b=1 c=3"
ans=eval( 'dict(%s)'%foo.replace(' ',',')) )
print ans
{'a': 0, 'c': 3, 'b': 1}
</code></pre>
| 3 | 2009-08-08T01:50:16Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,248,990 | <p>Try the next:</p>
<pre><code>dict([x.split('=') for x in s.split()])
</code></pre>
| 3 | 2009-08-08T14:17:31Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 1,249,077 | <p>I sometimes like this approach, especially when the logic for making keys and values is more complicated:</p>
<pre><code>s = "a=0 b=1 c=3"
def get_key_val(x):
a,b = x.split('=')
return a,int(b)
ans = dict(map(get_key_val,s.split()))
</code></pre>
| 2 | 2009-08-08T14:50:23Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 3,030,359 | <p>I would do this:</p>
<pre><code>def kv(e): return (e[0], int(e[1]))
d = dict([kv(e.split("=")) for e in string.split(" ")])
</code></pre>
| 0 | 2010-06-12T22:37:04Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
convert string to dict using list comprehension in python | 1,246,444 | <p>I have came across this problem a few times and can't seem to figure out a simple solution.
Say I have a string</p>
<pre><code> string = "a=0 b=1 c=3"
</code></pre>
<p>I want to convert that into a dictionary with a, b and c being the key and 0, 1, and 3 being their respective values (converted to int). Obvious... | 15 | 2009-08-07T19:00:32Z | 27,033,812 | <p>Nowadays you should probably use a dictionary comprehension, introduced in 2.7:</p>
<pre><code>mydict = {key: int(value) for key, value in (a.split('=') for a in mystring.split())}
</code></pre>
<p>The dictionary comprehension is faster and shinier (and, in my opinion, more readable).</p>
<pre><code>from timeit i... | 1 | 2014-11-20T07:13:58Z | [
"python",
"string",
"dictionary",
"list-comprehension",
"generator-expression"
] |
Getting the position of the gtk.StatusIcon on Windows | 1,246,552 | <p>I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff...</p>
<p>We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using th... | 4 | 2009-08-07T19:27:36Z | 1,247,303 | <p>Gtk provides function gtk_status_icon_position_menu that can be passed into gtk_menu_popup as a GtkPositionFunc.
This seems to provide the requested functionality.</p>
| 1 | 2009-08-07T22:33:14Z | [
"python",
"windows",
"gtk",
"pygtk"
] |
Getting the position of the gtk.StatusIcon on Windows | 1,246,552 | <p>I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff...</p>
<p>We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using th... | 4 | 2009-08-07T19:27:36Z | 1,874,016 | <p>The behavior i experienced in windows with gtk_status_icon_position_menu was that it spawns the window at the location the user clicked in the statusicon</p>
| 0 | 2009-12-09T13:48:27Z | [
"python",
"windows",
"gtk",
"pygtk"
] |
Getting the position of the gtk.StatusIcon on Windows | 1,246,552 | <p>I am assisting with Windows support for a PyGTK app that appears as a system tray applet, but am not so strong on the GTK+ gooey stuff...</p>
<p>We have it so when you left-click the systray icon, the window appears right by your tray icon no matter where your system tray is--and on Linux this works great, using th... | 4 | 2009-08-07T19:27:36Z | 3,262,115 | <p>I am also looking for an answer to this but have found something that might help.</p>
<p>It seems to me that GTK figures out where to bring up the PopupMenu from the mouse position. Somehow it figures out that the mouse button was clicked over the StatusIcon. Presumably either from mouse events sent by the window... | 0 | 2010-07-16T05:16:48Z | [
"python",
"windows",
"gtk",
"pygtk"
] |
How can I process this text file and parse what I need? | 1,246,752 | <p>I'm trying to parse ouput from the Python doctest module and store it in an HTML file.</p>
<p>I've got output similar to this:</p>
<pre><code>**********************************************************************
File "example.py", line 16, in __main__.factorial
Failed example:
[factorial(n) for n in range(6)]... | 2 | 2009-08-07T20:06:29Z | 1,247,033 | <p>You can write a Python program to pick this apart, but maybe a better thing to do would be to look into modifying doctest to output the report you want in the first place. From the docs for doctest.DocTestRunner:</p>
<pre><code> ... the display output
can be also customized by subcl... | 4 | 2009-08-07T21:10:35Z | [
"python",
"parsing",
"shell",
"doctest"
] |
How can I process this text file and parse what I need? | 1,246,752 | <p>I'm trying to parse ouput from the Python doctest module and store it in an HTML file.</p>
<p>I've got output similar to this:</p>
<pre><code>**********************************************************************
File "example.py", line 16, in __main__.factorial
Failed example:
[factorial(n) for n in range(6)]... | 2 | 2009-08-07T20:06:29Z | 1,247,039 | <p>This is a quick and dirty script that parses the output into tuples with the relevant information:</p>
<pre><code>import sys
import re
stars_re = re.compile('^[*]+$', re.MULTILINE)
file_line_re = re.compile(r'^File "(.*?)", line (\d*), in (.*)$')
doctest_output = sys.stdin.read()
chunks = stars_re.split(doctest_o... | 1 | 2009-08-07T21:11:11Z | [
"python",
"parsing",
"shell",
"doctest"
] |
How can I process this text file and parse what I need? | 1,246,752 | <p>I'm trying to parse ouput from the Python doctest module and store it in an HTML file.</p>
<p>I've got output similar to this:</p>
<pre><code>**********************************************************************
File "example.py", line 16, in __main__.factorial
Failed example:
[factorial(n) for n in range(6)]... | 2 | 2009-08-07T20:06:29Z | 1,247,149 | <p>I wrote a quick parser in pyparsing to do it.</p>
<pre><code>from pyparsing import *
str = """
**********************************************************************
File "example.py", line 16, in __main__.factorial
Failed example:
[factorial(n) for n in range(6)]
Expected:
[0, 1, 2, 6, 24, 120]
Got:
[... | 1 | 2009-08-07T21:43:23Z | [
"python",
"parsing",
"shell",
"doctest"
] |
How can I process this text file and parse what I need? | 1,246,752 | <p>I'm trying to parse ouput from the Python doctest module and store it in an HTML file.</p>
<p>I've got output similar to this:</p>
<pre><code>**********************************************************************
File "example.py", line 16, in __main__.factorial
Failed example:
[factorial(n) for n in range(6)]... | 2 | 2009-08-07T20:06:29Z | 1,247,291 | <p>This is probably one of the least elegant python scripts I've ever written, but it should have the framework to do what you want without resorting to UNIX utilities and separate scripts to create the html. It's untested, but it should only need minor tweaking to work.</p>
<pre><code>import os
import sys
#create a... | 0 | 2009-08-07T22:28:11Z | [
"python",
"parsing",
"shell",
"doctest"
] |
Can I use more than a single filter on a variable in template? | 1,246,968 | <p>For example:</p>
<pre><code>{{test|linebreaksbr|safe}}
</code></pre>
| 1 | 2009-08-07T20:57:01Z | 1,246,978 | <p>Yes you can, this is common practice to string together many filters consecutively.</p>
<p>Could you turn debugging on and see what the error is and update the question?</p>
<p>Make sure this is set in your settings.py</p>
<pre><code>DEBUG = True
TEMPLATE_DEBUG = DEBUG
</code></pre>
| 2 | 2009-08-07T20:57:55Z | [
"python",
"django",
"templates",
"filter"
] |
Can I use more than a single filter on a variable in template? | 1,246,968 | <p>For example:</p>
<pre><code>{{test|linebreaksbr|safe}}
</code></pre>
| 1 | 2009-08-07T20:57:01Z | 1,246,987 | <p>Yes, have you tried it? Did something go wrong?</p>
| 2 | 2009-08-07T20:59:06Z | [
"python",
"django",
"templates",
"filter"
] |
Recursive? looping to n levels in Python | 1,247,133 | <p>Working in python I want to extract a dataset with the following structure:</p>
<p>Each item has a unique ID and the unique ID of its parent. Each parent can have one or more children, each of which can have one or more children of its own, to n levels i.e. the data has an upturned tree-like structure. While it has... | 1 | 2009-08-07T21:38:22Z | 1,247,157 | <p>Are you saying that each item only maintains a reference to its parents? If so, then how about</p>
<pre><code>def getChildren(item) :
children = []
for possibleChild in allItems :
if (possibleChild.parent == item) :
children.extend(getChildren(possibleChild))
return children
</code><... | 1 | 2009-08-07T21:45:59Z | [
"python",
"recursion"
] |
Recursive? looping to n levels in Python | 1,247,133 | <p>Working in python I want to extract a dataset with the following structure:</p>
<p>Each item has a unique ID and the unique ID of its parent. Each parent can have one or more children, each of which can have one or more children of its own, to n levels i.e. the data has an upturned tree-like structure. While it has... | 1 | 2009-08-07T21:38:22Z | 1,247,268 | <p>If you want to keep the structure of your dataset, this will produce a list of the format [id, [children of id], id2, [children of id2]]</p>
<pre><code>def children(id):
return [id]+[children(x.id) for x in filter(lambda x:x.parent == id, ... | 1 | 2009-08-07T22:19:50Z | [
"python",
"recursion"
] |
Recursive? looping to n levels in Python | 1,247,133 | <p>Working in python I want to extract a dataset with the following structure:</p>
<p>Each item has a unique ID and the unique ID of its parent. Each parent can have one or more children, each of which can have one or more children of its own, to n levels i.e. the data has an upturned tree-like structure. While it has... | 1 | 2009-08-07T21:38:22Z | 1,247,290 | <p>you should probably use a defaultdictionary for this:</p>
<pre><code>from collections import defaultdict
itemdict = defaultdict(list)
for id, parent_id in itemlist:
itemdict[parent_id].append(id)
</code></pre>
<p>then you can recursively print it (with indentation) like</p>
<pre><code>def printitem(id, de... | 1 | 2009-08-07T22:27:11Z | [
"python",
"recursion"
] |
Recursive? looping to n levels in Python | 1,247,133 | <p>Working in python I want to extract a dataset with the following structure:</p>
<p>Each item has a unique ID and the unique ID of its parent. Each parent can have one or more children, each of which can have one or more children of its own, to n levels i.e. the data has an upturned tree-like structure. While it has... | 1 | 2009-08-07T21:38:22Z | 1,249,176 | <p>How about something like this,</p>
<pre><code>
#!/usr/bin/python
tree = { 0:(None, [1,2,3]),
1:(0, [4]),
2:(0, []),
3:(0, [5,6]),
4:(1, [7]),
5:(3, []),
... | 0 | 2009-08-08T15:44:28Z | [
"python",
"recursion"
] |
how to include % sign in docutils html template | 1,247,284 | <p>I want to generate HTML pages with rst2html, using my own templates. these templates include many % signs, like in</p>
<pre><code><TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
</code></pre>
<p>now, when I call rst2html using the command</p>
<pre><code>rst2html --template=layout2.tpl rst/in... | 1 | 2009-08-07T22:25:12Z | 1,247,287 | <p>Have you tried obvious things: escaping the '%' with '%'? </p>
<p>Here is normal string formatting to display a percent sign in the result:</p>
<pre><code>>>> print "%d%%" % 100
100%
</code></pre>
<p>Maybe rst2html is the same? (I haven't tried this in rst2html -- I don't have it installed.)</p>
<p>Okay... | 7 | 2009-08-07T22:26:32Z | [
"python"
] |
how to include % sign in docutils html template | 1,247,284 | <p>I want to generate HTML pages with rst2html, using my own templates. these templates include many % signs, like in</p>
<pre><code><TABLE border="0" cellpadding="0" cellspacing="0" width="100%">
</code></pre>
<p>now, when I call rst2html using the command</p>
<pre><code>rst2html --template=layout2.tpl rst/in... | 1 | 2009-08-07T22:25:12Z | 1,247,305 | <p>Doubt it, but maybe the XML command CDATA works.</p>
<pre><code><![CDATA[
...
]]>
</code></pre>
<p>I use it for storing paypal buttons in an XML document and inserting them with PHP.</p>
| 0 | 2009-08-07T22:33:52Z | [
"python"
] |
Elixir Entity with a list of tuples in it. ex. Cooking Recipe with list of (ingrediant, quantity) tuple | 1,247,343 | <p>I'm trying to build an elixir model in which I have a class with a list(of variable size) of tuples.</p>
<p>One example would be a recipe</p>
<p>while I can do something like this:</p>
<pre><code>class Recipe(Entity):
ingrediants = OneToMany('IngrediantList')
cooking_time = Field(Integer)
...
class I... | 0 | 2009-08-07T22:46:05Z | 1,253,951 | <p>This is the correct way to model composite objects. The only thing I'd change is the name of the IngredientList class. Something like RecipeEntry or IngredientQuantity would be more appropriate. Calling it a tuple is just trying to avoid the need to name the fact that a recipe needs some quantity of some ingredient.... | 0 | 2009-08-10T09:38:20Z | [
"python",
"sqlalchemy",
"python-elixir"
] |
Elixir Entity with a list of tuples in it. ex. Cooking Recipe with list of (ingrediant, quantity) tuple | 1,247,343 | <p>I'm trying to build an elixir model in which I have a class with a list(of variable size) of tuples.</p>
<p>One example would be a recipe</p>
<p>while I can do something like this:</p>
<pre><code>class Recipe(Entity):
ingrediants = OneToMany('IngrediantList')
cooking_time = Field(Integer)
...
class I... | 0 | 2009-08-07T22:46:05Z | 1,258,142 | <p><a href="http://www.sqlalchemy.org/docs/05/reference/ext/associationproxy.html#building-complex-views" rel="nofollow">solution using sqlalchemy associationproxy</a>
This is from the sqlalchemy docs.</p>
| 0 | 2009-08-11T02:03:18Z | [
"python",
"sqlalchemy",
"python-elixir"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 1,247,490 | <p><code>map</code> may be microscopically faster in some cases (when you're NOT making a lambda for the purpose, but using the same function in map and a listcomp). List comprehensions may be faster in other cases and most (not all) pythonistas consider them more direct and clearer.</p>
<p>An example of the tiny spee... | 360 | 2009-08-07T23:45:23Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 1,247,531 | <p>I find list comprehensions are generally more expressive of what I'm trying to do than <code>map</code> - they both get it done, but the former saves the mental load of trying to understand what could be a complex <code>lambda</code> expression.</p>
<p>There's also an interview out there somewhere (I can't find it ... | 14 | 2009-08-07T23:59:05Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 1,660,062 | <p>Here is one possible case:</p>
<pre><code>map(lambda op1,op2: op1*op2, list1, list2)
</code></pre>
<p>versus:</p>
<pre><code>[op1*op2 for op1,op2 in zip(list1,list2)]
</code></pre>
<p>I am guessing the zip() is an unfortunate and unnecessary overhead you need to indulge in if you insist on using list comprehensi... | 8 | 2009-11-02T08:42:48Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 2,307,517 | <p>Another reason to use list comprehension over map() and filter() is that Psyco can't compile these functions. </p>
<p>See <a href="http://psyco.sourceforge.net/" rel="nofollow">http://psyco.sourceforge.net/</a></p>
| 6 | 2010-02-21T21:27:28Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 6,407,222 | <p><strong>Cases</strong></p>
<ul>
<li><strong>Common case</strong>: Almost always, you will want to use a list comprehension in <em>python</em> because it will be more obvious what you're doing to novice programmers reading your code. (This does not apply to other languages, where other idioms may apply.) It will eve... | 244 | 2011-06-20T05:41:27Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 13,483,314 | <h2>You should use <code>map</code> and <code>filter</code> instead of list comprehensions.</h2>
<p>An <strong>objective</strong> reason why you should prefer them even though they're not "Pythonic" is this:<br>
They require functions/lambdas as arguments, which <strong>introduce a new scope</strong>.</p>
<p>I've got... | 46 | 2012-11-20T22:28:55Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 19,117,067 | <p>Actually, <code>map</code> and list comprehensions behave quite differently in the Python 3 language. Take a look at the following Python 3 program:</p>
<pre><code>def square(x):
return x*x
squares = map(square, [1, 2, 3])
print(list(squares))
print(list(squares))
</code></pre>
<p>You might expect it to print ... | 23 | 2013-10-01T13:09:13Z | [
"python",
"list-comprehension",
"map-function"
] |
Python List Comprehension Vs. Map | 1,247,486 | <p>Is there a reason to prefer using <code>map()</code> over list comprehension or vice versa? Is one generally more effecient or generally considered more pythonic than the other?</p>
| 376 | 2009-08-07T23:43:31Z | 24,108,573 | <p>If you plan on writing any asynchronous, parallel, or distributed code, you will probably prefer <code>map</code> over a list comprehension -- as most asynchronous, parallel, or distributed packages provide a <code>map</code> function to overload python's <code>map</code>. Then by passing the appropriate <code>map<... | 8 | 2014-06-08T17:03:13Z | [
"python",
"list-comprehension",
"map-function"
] |
django extreme slowness | 1,247,501 | <p>I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow.</p>
<p>Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds... | 2 | 2009-08-07T23:47:54Z | 1,247,506 | <blockquote>
<p>Then I thought it might be a DNS
issue, but the site loads instantly
when served with Apache2.</p>
</blockquote>
<p>How are you serving your Django site? I presume you're running mod_python on Apache2? </p>
<p>You may want to start by running an Apache2 locally on you computer (use MAMP or WAMP ... | 0 | 2009-08-07T23:51:12Z | [
"python",
"django"
] |
django extreme slowness | 1,247,501 | <p>I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow.</p>
<p>Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds... | 2 | 2009-08-07T23:47:54Z | 1,247,516 | <p>I've posted <a href="http://serverfault.com/questions/47112/django-site-performance-problem">this question</a> on serverfault maybe it will help you. </p>
<p>If you are serving big static files - those will slow down response.</p>
<p>This will be the case in any mode if your mod_python or development server proces... | 6 | 2009-08-07T23:54:41Z | [
"python",
"django"
] |
django extreme slowness | 1,247,501 | <p>I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow.</p>
<p>Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds... | 2 | 2009-08-07T23:47:54Z | 1,247,774 | <p>I've once used remote edit to develop my Django site. The validating process seem to be very slow too. But, everything else is fine not like yours. </p>
<p>It's come from the webserver can't add/change .pyc in that directory.</p>
| 0 | 2009-08-08T02:16:33Z | [
"python",
"django"
] |
django extreme slowness | 1,247,501 | <p>I have a slowness problem with Django and I can't find the source .. I'm not sure what I'm doing wrong, but at least twice while working on projects Django became really slow.</p>
<p>Requests takes age to complete (~15 seconds) and Validating model when starting the development server is also very slow (12+ seconds... | 2 | 2009-08-07T23:47:54Z | 1,248,504 | <p>If the validating models takes forever don't search for anything else. On a dual core some of my largest enterprise applications (+30 models) take less then a second to validate.</p>
<p>The problem must lie somewhere with your models but without source code it's hard to tell what the problem is.</p>
<p>Kind regard... | 0 | 2009-08-08T10:16:52Z | [
"python",
"django"
] |
Finding the domain name of a site that is hotlinking in Google app engine using web2py | 1,247,593 | <p>Let's say we have an image in the Google App Engine and sites are hotlinking it.
How can I find the domain names of the sites?</p>
<p>My first thought was:</p>
<blockquote>
<p>request.client</p>
</blockquote>
<p>and then do a reverse lookup but that it's not possible in GAE and would take a lot of time.
I am pr... | 2 | 2009-08-08T00:26:46Z | 1,247,600 | <p>You can easily get the referrer from the request headers. This referrer can be spoofed, but most people do not spoof it and it is already resolved.</p>
<p>There is no automatic way to resolve the DNS other than manually resolving it. Like you said, a DNS resolution takes extra time and it makes no sense for Web2Py ... | 2 | 2009-08-08T00:31:28Z | [
"python",
"google-app-engine",
"web2py",
"reverse-lookup"
] |
Finding the domain name of a site that is hotlinking in Google app engine using web2py | 1,247,593 | <p>Let's say we have an image in the Google App Engine and sites are hotlinking it.
How can I find the domain names of the sites?</p>
<p>My first thought was:</p>
<blockquote>
<p>request.client</p>
</blockquote>
<p>and then do a reverse lookup but that it's not possible in GAE and would take a lot of time.
I am pr... | 2 | 2009-08-08T00:26:46Z | 1,247,766 | <p>If you're just looking to find out the domain names (not to block the requests by running a script when the image URL is requested), then they'll be in the request logs. In the admin thingy go to "Logs", select "Requests only" from the drop-down. If you expand "Options" you can filter on the relevant filename.</p>
... | 1 | 2009-08-08T02:08:47Z | [
"python",
"google-app-engine",
"web2py",
"reverse-lookup"
] |
Web Service require Python List as argument. Need to invoke from C# | 1,247,638 | <p>I need to consume a webservice over XML-RPC. The webservice is written in Python, and one of the arguments is a Python list.</p>
<p>I'm using <a href="http://xml-rpc.net/" rel="nofollow">XML-RPC.NET</a> to invoke all the methods and it works fine, except for those that require a Python list argument.</p>
<p>What w... | 1 | 2009-08-08T00:50:28Z | 1,247,642 | <p>What you need to obtain in the underlying XML is an <code><array></code> tag, e.g.</p>
<pre><code><array>
<data>
<value><i4>12</i4></value>
<value><string>Egypt</string></value>
<value><boolean>0</boolean></v... | 1 | 2009-08-08T00:55:33Z | [
"c#",
"python",
"xml-rpc"
] |
Web Service require Python List as argument. Need to invoke from C# | 1,247,638 | <p>I need to consume a webservice over XML-RPC. The webservice is written in Python, and one of the arguments is a Python list.</p>
<p>I'm using <a href="http://xml-rpc.net/" rel="nofollow">XML-RPC.NET</a> to invoke all the methods and it works fine, except for those that require a Python list argument.</p>
<p>What w... | 1 | 2009-08-08T00:50:28Z | 1,247,655 | <p>You need to use arrays of System.Object[]. See <a href="http://www.xml-rpc.net/faq/xmlrpcnetfaq.html#1.12" rel="nofollow">http://www.xml-rpc.net/faq/xmlrpcnetfaq.html#1.12</a> These are generally equivalent to Python lists.</p>
| 2 | 2009-08-08T01:04:13Z | [
"c#",
"python",
"xml-rpc"
] |
Python - printing out all references to a specific instance | 1,247,697 | <p>I am investigating garbage collection issues in a Python app. What would be the best readable option to print out all variables referencing a specific instance?</p>
| 4 | 2009-08-08T01:24:23Z | 1,248,024 | <p>Use the inspect module. This script helps if you just want to track down reference leaks:</p>
<p><a href="http://mg.pov.lt/objgraph.py" rel="nofollow">http://mg.pov.lt/objgraph.py</a> <a href="http://mg.pov.lt/blog/hunting-python-memleaks" rel="nofollow">http://mg.pov.lt/blog/hunting-python-memleaks</a> <a href="h... | 3 | 2009-08-08T05:04:25Z | [
"python",
"oop",
"garbage-collection"
] |
Python - printing out all references to a specific instance | 1,247,697 | <p>I am investigating garbage collection issues in a Python app. What would be the best readable option to print out all variables referencing a specific instance?</p>
| 4 | 2009-08-08T01:24:23Z | 1,248,398 | <p>Try <a href="http://pythonic.pocoo.org/2009/5/30/finding-objects-names" rel="nofollow">Finding objects' names</a>, it prints all names that reference a given object.</p>
| 2 | 2009-08-08T09:06:38Z | [
"python",
"oop",
"garbage-collection"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 1,247,869 | <p>Monty never opens the door with the car - that's the whole point of the show (he isn't your friend an has knowledge of what is behind each door)</p>
| 0 | 2009-08-08T03:17:27Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 1,247,875 | <p>You mentioned that all the choices are hardcoded in. But if you look closer, you'll notice that what you think are 'choices' are actually not choices at all. Monty's decision is without loss of generality since he always chooses the door with the goat behind it. Your swapping is always determined by what Monty choos... | 1 | 2009-08-08T03:20:44Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 1,247,888 | <p>Your solution is fine, but if you want a stricter simulation of the problem as posed (and somewhat higher-quality Python;-), try:</p>
<pre><code>import random
iterations = 100000
doors = ["goat"] * 2 + ["car"]
change_wins = 0
change_loses = 0
for i in xrange(iterations):
random.shuffle(doors)
# you pick ... | 32 | 2009-08-08T03:28:15Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 1,249,100 | <p>I like something like this.</p>
<pre><code>
#!/usr/bin/python
import random
CAR = 1
GOAT = 0
def one_trial( doors, switch=False ):
"""One trial of the Monty Hall contest."""
random.shuffle( doors... | 1 | 2009-08-08T15:00:23Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 3,617,844 | <p>Here is an interactive version:</p>
<pre><code>from random import shuffle, choice
cars,goats,iters= 0, 0, 100
for i in range(iters):
doors = ['goat A', 'goat B', 'car']
shuffle(doors)
moderator_door = 'car'
#Turn 1:
selected_door = choice(doors)
print selected_door
doors.remove(selected_... | 0 | 2010-09-01T12:13:41Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 3,671,645 | <p>I hadn't heard of the Monty Hall Problem before I stumbled across this question. I thought it was interesting, so I read about it and created a c# simulation. It's kind of goofy since it simulates the game-show and not just the problem.</p>
<p>I published the source and release on codeplex:</p>
<p><a href="http://... | 1 | 2010-09-08T20:32:35Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 8,225,497 | <p>Another code sample is available at: <a href="http://standardwisdom.com/softwarejournal/code-samples/monty-hall-python/" rel="nofollow">http://standardwisdom.com/softwarejournal/code-samples/monty-hall-python/</a></p>
<p>The code is a bit longer and may not use some of Python's cool features, but I hope it is nicel... | 0 | 2011-11-22T10:43:53Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 11,833,365 | <p>My solution with list comprehension to simulate the problem</p>
<pre><code>from random import randint
N = 1000
def simulate(N):
car_gate=[randint(1,3) for x in range(N)]
gate_sel=[randint(1,3) for x in range(N)]
score = sum([True if car_gate[i] == gate_sel[i] or ([posible_gate for posible_gate in [1... | 0 | 2012-08-06T17:52:48Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 15,328,086 | <p>Here is different variant I find most intuitive. Hope this helps!</p>
<pre><code>import random
class MontyHall():
"""A Monty Hall game simulator."""
def __init__(self):
self.doors = ['Door #1', 'Door #2', 'Door #3']
self.prize_door = random.choice(self.doors)
self.contestant_choice ... | 0 | 2013-03-10T21:48:45Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 18,693,512 | <p>Not mine sample</p>
<pre><code># -*- coding: utf-8 -*-
#!/usr/bin/python -Ou
# Written by kocmuk.ru, 2008
import random
num = 10000 # number of games to play
win = 0 # init win count if donot change our first choice
for i in range(1, num): # play "num" games
if random.randint(... | 0 | 2013-09-09T07:38:04Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 20,641,764 | <p>Here's one I made earlier:</p>
<pre><code>import random
def game():
"""
Set up three doors, one randomly with a car behind and two with
goats behind. Choose a door randomly, then the presenter takes away
one of the goats. Return the outcome based on whether you stuck with
your original choice o... | 0 | 2013-12-17T18:18:54Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 24,590,519 | <p>Here is my solution to the MontyHall problem implemented in python.</p>
<p>This solution makes use of numpy for speed, it also allows you to change the number of doors.</p>
<pre><code>def montyhall(Trials:"Number of trials",Doors:"Amount of doors",P:"Output debug"):
N = Trials # the amount of trial
DoorSiz... | 0 | 2014-07-05T21:00:01Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 29,750,121 | <p>Here's my version ...</p>
<pre><code># by peedurrr
#
import random
wins = 0
for n in range(1000):
doors = [1, 2, 3]
carDoor = random.choice(doors)
playerDoor = random.choice(doors)
hostDoor = random.choice(list(set(doors) - set([carDoor, playerDoor])))
# To stick, just comment out t... | 1 | 2015-04-20T14:03:47Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 30,945,981 | <p>I found this to be the most intuitive way of solving the problem.</p>
<pre><code>import random
# game_show will return True/False if the participant wins/loses the car:
def game_show(knows_bayes):
doors = [i for i in range(3)]
# Let the car be behind this door
car = random.choice(doors)
# The pa... | 0 | 2015-06-19T19:35:17Z | [
"python",
"language-agnostic",
"probability"
] |
Is this a good or bad 'simulation' for Monty Hall? How come? | 1,247,863 | <p>Through trying to explain the <a href="http://en.wikipedia.org/wiki/Monty_Hall_problem" rel="nofollow">Monty Hall problem</a> to a friend during class yesterday, we ended up coding it in Python to prove that if you always swap, you will win 2/3 times. We came up with this:</p>
<pre><code>import random as r
#iterat... | 14 | 2009-08-08T03:13:17Z | 37,274,039 | <p>Read a chapter about the famous Monty Hall problem today. This is my solution. </p>
<pre><code>import random
def one_round():
doors = [1,1,0] # 1==goat, 0=car
random.shuffle(doors) # shuffle doors
choice = random.randint(0,2)
return doors[choice]
#If a goat is chosen, it means the player lose... | 0 | 2016-05-17T10:51:41Z | [
"python",
"language-agnostic",
"probability"
] |
Coroutines for game design? | 1,247,894 | <p>I've heard that coroutines are a good way to structure games (e.g., <a href="http://www.python.org/dev/peps/pep-0342/">PEP 342</a>: "Coroutines are a natural way of expressing many algorithms, such as simulations, games...") but I'm having a hard time wrapping my head around how this would actually be done.</p>
<p>... | 16 | 2009-08-08T03:31:01Z | 1,247,973 | <p>Two links that you might find interesting:</p>
<p><a href="http://aigamedev.com/open/articles/coroutine-state-machine/" rel="nofollow">http://aigamedev.com/open/articles/coroutine-state-machine/</a></p>
<p><a href="http://www.dabeaz.com/coroutines/" rel="nofollow">http://www.dabeaz.com/coroutines/</a> (search for ... | 2 | 2009-08-08T04:28:34Z | [
"python",
"coroutine"
] |
Coroutines for game design? | 1,247,894 | <p>I've heard that coroutines are a good way to structure games (e.g., <a href="http://www.python.org/dev/peps/pep-0342/">PEP 342</a>: "Coroutines are a natural way of expressing many algorithms, such as simulations, games...") but I'm having a hard time wrapping my head around how this would actually be done.</p>
<p>... | 16 | 2009-08-08T03:31:01Z | 1,247,985 | <p>Coroutines allow for creating large amounts of very-lightweight "microthreads" with cooperative multitasking (i.e. microthreads suspending themselves willfully to allow other microthreads to run). Read up in Dave Beazley's <a href="http://www.dabeaz.com/coroutines/">article</a> on this subject.</p>
<p>Now, it's obv... | 9 | 2009-08-08T04:35:05Z | [
"python",
"coroutine"
] |
Coroutines for game design? | 1,247,894 | <p>I've heard that coroutines are a good way to structure games (e.g., <a href="http://www.python.org/dev/peps/pep-0342/">PEP 342</a>: "Coroutines are a natural way of expressing many algorithms, such as simulations, games...") but I'm having a hard time wrapping my head around how this would actually be done.</p>
<p>... | 16 | 2009-08-08T03:31:01Z | 1,247,990 | <p>One way coroutines can be used in games is as light weight threads in an actor like model, like in <a href="http://www.kamaelia.org/Home">Kamaelia</a>.</p>
<p>Each object in your game would be a Kamaelia 'component'. A component is an object that can pause execution by yielding when it's allowable to pause. These c... | 7 | 2009-08-08T04:37:30Z | [
"python",
"coroutine"
] |
Coroutines for game design? | 1,247,894 | <p>I've heard that coroutines are a good way to structure games (e.g., <a href="http://www.python.org/dev/peps/pep-0342/">PEP 342</a>: "Coroutines are a natural way of expressing many algorithms, such as simulations, games...") but I'm having a hard time wrapping my head around how this would actually be done.</p>
<p>... | 16 | 2009-08-08T03:31:01Z | 1,250,992 | <p>The most prominent case of coroutines are probally old graphical point&click adventure games, where they where used to script cutscenes and other animated sequences in the game. A simple code example would look like this:</p>
<pre><code># script_file.scr
bob.walkto(jane)
bob.lookat(jane)
bob.say("How are you?")... | 8 | 2009-08-09T09:11:34Z | [
"python",
"coroutine"
] |
Coroutines for game design? | 1,247,894 | <p>I've heard that coroutines are a good way to structure games (e.g., <a href="http://www.python.org/dev/peps/pep-0342/">PEP 342</a>: "Coroutines are a natural way of expressing many algorithms, such as simulations, games...") but I'm having a hard time wrapping my head around how this would actually be done.</p>
<p>... | 16 | 2009-08-08T03:31:01Z | 1,255,130 | <p>It is quite common to want to use coroutines to represent individual actor AI scripts. Unfortunately people tend to forget that coroutines have all the same synchronisation and mutual exclusion problems that threads have, just at a higher level. So you often need to firstly do as much as you can to eliminate local s... | 1 | 2009-08-10T14:16:26Z | [
"python",
"coroutine"
] |
How to make translucent sprites in pygame | 1,247,921 | <p>I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.</p>
| 4 | 2009-08-08T03:51:39Z | 1,247,962 | <p>After loading the image, you will need to enable an alpha channel on the <code>Surface</code>. that will look a little like this:</p>
<pre><code>background = pygame.Display.set_mode()
myimage = pygame.image.load("path/to/image.bmp").convert_alpha(background)
</code></pre>
<p>This will load the image and immediate... | 3 | 2009-08-08T04:21:41Z | [
"python",
"graphics",
"sprite",
"pygame"
] |
How to make translucent sprites in pygame | 1,247,921 | <p>I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.</p>
| 4 | 2009-08-08T03:51:39Z | 1,247,984 | <p>you might consider switching to using png images where you can do any kind of transparency you want directly in the image.</p>
| 1 | 2009-08-08T04:34:59Z | [
"python",
"graphics",
"sprite",
"pygame"
] |
How to make translucent sprites in pygame | 1,247,921 | <p>I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.</p>
| 4 | 2009-08-08T03:51:39Z | 1,248,120 | <p>If your image has a solid color background that you want it to became transparent you can set it as <a href="http://www.pygame.org/docs/ref/surface.html#Surface.set%5Fcolorkey" rel="nofollow">color_key</a> value, and pygame will make it transparent when blitting the image.</p>
<p>eg:</p>
<pre><code>color = image.g... | 2 | 2009-08-08T06:19:04Z | [
"python",
"graphics",
"sprite",
"pygame"
] |
How to make translucent sprites in pygame | 1,247,921 | <p>I've just started working with pygame and I'm trying to make a semi-transparent sprite, and the sprite's source file is a non-transparent bitmap file loaded from the disk. I don't want to edit the source image if I can help it. I'm sure there's a way to do this with pygame code, but Google is of no help to me.</p>
| 4 | 2009-08-08T03:51:39Z | 1,253,061 | <p>I may have not been clear in my original question, but I think I figured it out on my own. What I was looking for turns out to be Surface's set_alpha() method, so all I had to do was make sure that translucent images were on their own surface.</p>
<p>Here's an example with my stripped down code:</p>
<pre><code>imp... | 2 | 2009-08-10T04:01:55Z | [
"python",
"graphics",
"sprite",
"pygame"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,825 | <p><code>s!foo!bar!</code> is the same as the more common <code>s/foo/bar/</code>, except that foo and bar can contain unescaped slashes without causing problems. What it does is, it replaces the first occurence of the regex foo with bar. The version with g replaces all occurences.</p>
| 15 | 2009-08-08T12:59:14Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,831 | <p><code>s</code> is the substitution operator. Normally this uses '/' for the delimiter:</p>
<pre><code>s/foo/bar/
</code></pre>
<p>, but this is not required: a number of other characters can be used as delimiters instead. In this case, '!' has been used as the delimiter, presumably to avoid the need to escape the ... | 2 | 2009-08-08T13:01:29Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,832 | <p>It's doing exactly the same as <code>$var =~ s///</code>. i.e. performing a search and replace within the <code>$var</code> variable.</p>
<p>In Perl you can define the delimiting character following the <code>s</code>. Why ? So, for example, if you're matching '/', you can specify another delimiting character ('!' ... | 13 | 2009-08-08T13:01:40Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,834 | <p>And the python equivalent is to use the <code>re</code> module.</p>
| 0 | 2009-08-08T13:01:56Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,839 | <p>s is the substitution operator. Usually it is in the form of <code>s/foo/bar/</code>, but you can replace // separator characters some other characters like <em>!</em>. Using other separator charaters may make working with things like paths a lot easier since you don't need to escape path separators.</p>
<p>See <a ... | 3 | 2009-08-08T13:02:34Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,841 | <p>Perl lets you choose the delimiter for many of its constructs. This makes it easier to see what is going on in expressions like</p>
<pre><code>$str =~ s{/foo/bar/baz/}{/quux/};
</code></pre>
<p>As you can see though, not all delimiters have the same effects. Bracketing characters (<code><></code>, <code>[]... | 10 | 2009-08-08T13:02:43Z | [
"python",
"regex",
"perl"
] |
What does the "s!" operator in Perl do? | 1,248,812 | <p>I have this Perl snippet from a script that I am translating into Python. I have no idea what the "s!" operator is doing; some sort of regex substitution. Unfortunately searching Google or Stackoverflow for operators like that doesn't yield many helpful results.</p>
<pre><code> $var =~ s!<foo>.+?</foo>!... | 4 | 2009-08-08T12:53:43Z | 1,248,842 | <p><code>s!</code> is syntactic sugar for the 'proper' <code>s///</code> operator. Basically, you can substitute whatever delimiter you want instead of the '/'s.</p>
<p>As to what each line is doing, the first line is matching occurances of the regex <code><foo>.+?</foo></code> and replacing the whole lot ... | 2 | 2009-08-08T13:03:16Z | [
"python",
"regex",
"perl"
] |
Best practise when using httplib2.Http() object | 1,248,926 | <p>I'm writing a pythonic web API wrapper with a class like this</p>
<pre><code>import httplib2
import urllib
class apiWrapper:
def __init__(self):
self.http = httplib2.Http()
def _http(self, url, method, dict):
'''
Im using this wrapper arround the http object
all the time inside the cl... | 6 | 2009-08-08T13:53:34Z | 1,249,097 | <p>You should keep the Http object if you reuse connections. It seems httplib2 is capable of reusing connections the way you use it in your first code, so this looks like a good approach.</p>
<p>At the same time, from a shallow inspection of the httplib2 code, it seems that httplib2 has no support for cleaning up unus... | 2 | 2009-08-08T14:59:42Z | [
"python",
"httplib2"
] |
Best practise when using httplib2.Http() object | 1,248,926 | <p>I'm writing a pythonic web API wrapper with a class like this</p>
<pre><code>import httplib2
import urllib
class apiWrapper:
def __init__(self):
self.http = httplib2.Http()
def _http(self, url, method, dict):
'''
Im using this wrapper arround the http object
all the time inside the cl... | 6 | 2009-08-08T13:53:34Z | 2,628,458 | <p>Supplying 'connection': 'close' in your headers should according to the docs close the connection after a response is received.:</p>
<pre><code>headers = {'connection': 'close'}
resp, content = h.request(url, headers=headers)
</code></pre>
| 7 | 2010-04-13T09:38:57Z | [
"python",
"httplib2"
] |
Escaping HTML in Python | 1,249,163 | <p>How to escape HTML with characters like <code>&#8211;</code> in Python?</p>
| 1 | 2009-08-08T15:38:17Z | 1,249,326 | <p>If you have a unicode string as input, you can use the xmlcharrefreplace error handler:</p>
<pre><code>py> u"<p>\N{EN DASH}</p>".encode("ascii", "xmlcharrefreplace")
'<p>&#8211;</p>'
</code></pre>
| 2 | 2009-08-08T16:52:23Z | [
"python",
"html",
"escaping"
] |
Escaping HTML in Python | 1,249,163 | <p>How to escape HTML with characters like <code>&#8211;</code> in Python?</p>
| 1 | 2009-08-08T15:38:17Z | 32,679,809 | <p>Try this</p>
<pre><code>import cgi
print cgi.escape("<b>Your HTML Bold Text</b>")
</code></pre>
| 0 | 2015-09-20T13:15:19Z | [
"python",
"html",
"escaping"
] |
Portable command execution syntax implemented in Python | 1,249,165 | <p>Python is not a pretty good language in <em>defining</em> a set of commands to run. Bash is. But Bash does not run naively on Windows.</p>
<p>Background: I am trying to build a set of programs - with established dependency relationships between them - on mac/win/linux. Something like macports but should work on all... | 1 | 2009-08-08T15:38:42Z | 1,249,183 | <p>Sounds like you need some combination of <a href="http://pyparsing.wikispaces.com/" rel="nofollow">PyParsing</a> and <a href="http://docs.python.org/library/subprocess.html" rel="nofollow">Python Subprocess</a>.</p>
<p>I find subprocess a little confusing, despite the <a href="http://blog.doughellmann.com/2007/07/p... | 2 | 2009-08-08T15:49:25Z | [
"python",
"shell",
"cross-platform",
"command"
] |
Portable command execution syntax implemented in Python | 1,249,165 | <p>Python is not a pretty good language in <em>defining</em> a set of commands to run. Bash is. But Bash does not run naively on Windows.</p>
<p>Background: I am trying to build a set of programs - with established dependency relationships between them - on mac/win/linux. Something like macports but should work on all... | 1 | 2009-08-08T15:38:42Z | 1,249,258 | <p>Ned Batchelder, in <a href="http://nedbatchelder.com/text/python-parsers.html" rel="nofollow">this post</a>, lists several dozens of different tools you might choose to perform parsing, in Python, of some arbitrary language (though I don't quite understand why you don't want to use Python itself as your "language to... | 1 | 2009-08-08T16:25:04Z | [
"python",
"shell",
"cross-platform",
"command"
] |
Portable command execution syntax implemented in Python | 1,249,165 | <p>Python is not a pretty good language in <em>defining</em> a set of commands to run. Bash is. But Bash does not run naively on Windows.</p>
<p>Background: I am trying to build a set of programs - with established dependency relationships between them - on mac/win/linux. Something like macports but should work on all... | 1 | 2009-08-08T15:38:42Z | 1,252,426 | <p>Here's my trivial suggestion: parse it via regexp to Python so it becomes</p>
<pre><code>def post_destroot():
xinstall ('-d', '${destroot}${prefix}/share/emacs/${version}/leim')
delete ('${destroot}${prefix}/bin/ctags')
delete ('${destroot}${prefix}/share/man/man1/ctags.1')
if test('variant_isset', ... | 0 | 2009-08-09T22:03:35Z | [
"python",
"shell",
"cross-platform",
"command"
] |
Python leaking memory while using PyQt and matplotlib | 1,249,182 | <p>I've created a small PyQt based utility in Python that creates PNG graphs using matplotlib when a user clicks a button. Everything works well during the first few clicks, however each time an image is created, the application's memory footprint grows about 120 MB, eventually crashing Python altogether.</p>
<p>How c... | 6 | 2009-08-08T15:49:14Z | 1,249,207 | <p>It seems that some backends are leaking memory. Try setting your backend explicitly, e.g.</p>
<pre><code>import matplotlib
matplotlib.use('Agg') # before import pylab
import pylab
</code></pre>
| 7 | 2009-08-08T15:57:59Z | [
"python",
"memory-leaks",
"pyqt",
"matplotlib"
] |
Python leaking memory while using PyQt and matplotlib | 1,249,182 | <p>I've created a small PyQt based utility in Python that creates PNG graphs using matplotlib when a user clicks a button. Everything works well during the first few clicks, however each time an image is created, the application's memory footprint grows about 120 MB, eventually crashing Python altogether.</p>
<p>How c... | 6 | 2009-08-08T15:49:14Z | 1,253,972 | <p>The pyplot interface is meant for easy interactive use, but for embedding in an application the object-oriented API is better. For example, pyplot keeps track of all figures you have created. Your <code>plot.close(figure)</code> <em>should</em> get rid of them, but maybe it doesn't get executed -- try putting it ins... | 6 | 2009-08-10T09:44:18Z | [
"python",
"memory-leaks",
"pyqt",
"matplotlib"
] |
Removing all non-numeric characters from string in Python | 1,249,388 | <p>How do we remove all non-numeric characters from a string in Python?</p>
| 63 | 2009-08-08T17:13:01Z | 1,249,398 | <p>Not sure if this is the most efficient way, but:</p>
<pre><code>>>> ''.join(c for c in "abc123def456" if c.isdigit())
'123456'
</code></pre>
<p>The <code>''.join</code> part means to combine all the resulting characters together without any characters in between. Then the rest of it is a list comprehensi... | 48 | 2009-08-08T17:16:55Z | [
"python",
"numbers"
] |
Removing all non-numeric characters from string in Python | 1,249,388 | <p>How do we remove all non-numeric characters from a string in Python?</p>
| 63 | 2009-08-08T17:13:01Z | 1,249,424 | <pre><code>>>> import re
>>> re.sub("[^0-9]", "", "sdkjh987978asd098as0980a98sd")
'987978098098098'
</code></pre>
| 118 | 2009-08-08T17:25:21Z | [
"python",
"numbers"
] |
Removing all non-numeric characters from string in Python | 1,249,388 | <p>How do we remove all non-numeric characters from a string in Python?</p>
| 63 | 2009-08-08T17:13:01Z | 1,249,449 | <p>Fastest approach, if you need to perform more than just one or two such removal operations (or even just one, but on a very long string!-), is to rely on the <code>translate</code> method of strings, even though it does need some prep:</p>
<pre><code>>>> import string
>>> allchars = ''.join(chr(i)... | 3 | 2009-08-08T17:35:59Z | [
"python",
"numbers"
] |
Removing all non-numeric characters from string in Python | 1,249,388 | <p>How do we remove all non-numeric characters from a string in Python?</p>
| 63 | 2009-08-08T17:13:01Z | 1,387,394 | <p>This should work for strings and unicode objects:</p>
<pre><code># python <3.0
def only_numerics(seq):
return filter(type(seq).isdigit, seq)
# python â¥3.0
def only_numerics(seq):
seq_type= type(seq)
return seq_type().join(filter(seq_type.isdigit, seq))
</code></pre>
| 10 | 2009-09-07T03:01:27Z | [
"python",
"numbers"
] |
Removing all non-numeric characters from string in Python | 1,249,388 | <p>How do we remove all non-numeric characters from a string in Python?</p>
| 63 | 2009-08-08T17:13:01Z | 12,316,431 | <p>Just to add another option to the mix, there are several useful constants within the <code>string</code> module. While more useful in other cases, they can be used here.</p>
<pre><code>>>> from string import digits
>>> ''.join(c for c in "abc123def456" if c in digits)
'123456'
</code></pre>
<p>Th... | 2 | 2012-09-07T10:37:03Z | [
"python",
"numbers"
] |
Is the default configuration of re incorrect on macbooks? Or have I simply misunderstood something? | 1,249,390 | <p>Python came pre-installed on my macbook and I have been slowly getting acquainted with the langauge. However, it seems that my configuration of the re library is incorrect, or I simply misunderstand something and things are amiss. Whenever I run a python script with "import re", I recieve the following error:</p>
... | 0 | 2009-08-08T17:13:47Z | 1,249,419 | <p>Pretty mysterious problem, given that line 4 in that file (and many other lines around that line number) is a comment (indeed the error msg itself shows that comment line!-) so even with the worst misconfiguration I'd be hard put to reproduce the problem as given.</p>
<p>Let's try to simplify things and check how t... | 3 | 2009-08-08T17:24:18Z | [
"python",
"regex"
] |
`cat filename | grep -B 5 -C 5 foo` | 1,249,412 | <pre><code>for filename in os.listdir("."):
for line in open(filename).xreadlines():
if "foo" in line:
print line
</code></pre>
<p>So this is a simple python equivalent of <code>cat filename | grep foo</code>. However, I would like the equivalent of <code>cat filename | grep -B 5 -C 5 foo</code... | 2 | 2009-08-08T17:22:35Z | 1,249,428 | <p>Simplest way is:</p>
<pre><code>for filename in os.listdir("."):
lines = open(filename).readlines()
for i, line in enumerate(lines):
if "foo" in line:
for x in lines[i-5 : i+6]:
print x,
</code></pre>
<p>add line numbers, breaks between blocks, etc, to taste;-).</p>
<p>... | 7 | 2009-08-08T17:27:04Z | [
"python",
"grep"
] |
`cat filename | grep -B 5 -C 5 foo` | 1,249,412 | <pre><code>for filename in os.listdir("."):
for line in open(filename).xreadlines():
if "foo" in line:
print line
</code></pre>
<p>So this is a simple python equivalent of <code>cat filename | grep foo</code>. However, I would like the equivalent of <code>cat filename | grep -B 5 -C 5 foo</code... | 2 | 2009-08-08T17:22:35Z | 1,249,705 | <p>Although I like the simplicity of Alex's answer, it would require lots of memory when grepping large files. How about this algorithm?</p>
<pre><code>import os
for filename in (f for f in os.listdir(".") if os.path.isfile(f)):
prevLines = []
followCount = 0
for line in open(filename):
prevLines.... | 1 | 2009-08-08T19:29:37Z | [
"python",
"grep"
] |
Simple python/Regex problem: Removing all new lines from a file | 1,249,670 | <p>I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:</p>
<p>I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish t... | 14 | 2009-08-08T19:15:59Z | 1,249,685 | <pre><code>import re
re.sub("\n", "", file-contents-here)
</code></pre>
| 3 | 2009-08-08T19:21:59Z | [
"python",
"regex"
] |
Simple python/Regex problem: Removing all new lines from a file | 1,249,670 | <p>I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:</p>
<p>I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish t... | 14 | 2009-08-08T19:15:59Z | 1,249,710 | <p>I wouldn't use a regex for simply replacing newlines - I'd use <code>string.replace()</code>. Here's a complete script:</p>
<pre><code>f = open('input.txt')
contents = f.read()
f.close()
new_contents = contents.replace('\n', '')
f = open('output.txt', 'w')
f.write(new_contents)
f.close()
</code></pre>
| 5 | 2009-08-08T19:33:14Z | [
"python",
"regex"
] |
Simple python/Regex problem: Removing all new lines from a file | 1,249,670 | <p>I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:</p>
<p>I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish t... | 14 | 2009-08-08T19:15:59Z | 1,249,740 | <p>The two main alternatives: read everything in as a single string and remove newlines:</p>
<pre><code>clean = open('thefile.txt').read().replace('\n', '')
</code></pre>
<p>or, read line by line, removing the newline that ends each line, and join it up again:</p>
<pre><code>clean = ''.join(l[:-1] for l in open('the... | 23 | 2009-08-08T19:54:28Z | [
"python",
"regex"
] |
Simple python/Regex problem: Removing all new lines from a file | 1,249,670 | <p>I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:</p>
<p>I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish t... | 14 | 2009-08-08T19:15:59Z | 1,249,744 | <p>I know this is a python learning problem, but if you're ever trying to do this from the command-line, there's no need to write a python script. Here are a couple of other ways:</p>
<pre><code>cat $FILE | tr -d '\n'
awk '{printf("%s", $0)}' $FILE
</code></pre>
<p>Neither of these has to read the entire file into m... | 2 | 2009-08-08T19:58:10Z | [
"python",
"regex"
] |
Simple python/Regex problem: Removing all new lines from a file | 1,249,670 | <p>I'm becoming acquainted with python and am creating problems in order to help myself learn the ins and outs of the language. My next problem comes as follows:</p>
<p>I have copied and pasted a huge slew of text from the internet, but the copy and paste added several new lines to break up the huge string. I wish t... | 14 | 2009-08-08T19:15:59Z | 9,051,969 | <p>Old question, but since it was in my search results for a similar query, and no one has mentioned the python string functions <code>strip() || lstrip() || rstrip()</code>, I'll just add that for posterity (and anyone who prefers not to use re when not necessary):</p>
<pre><code>old = open('infile.txt')
new = open(... | 0 | 2012-01-29T08:41:57Z | [
"python",
"regex"
] |
Is there a string-collapse library function in python? | 1,249,786 | <p>Is there a cross-platform library function that would collapse a multiline string into a single-line string with no repeating spaces?</p>
<p>I've come up with some snip below, but I wonder if there is a standard function which I could just import which is perhaps even optimized in C?</p>
<pre><code>def collapse(in... | 4 | 2009-08-08T20:18:54Z | 1,249,792 | <pre><code>multi_line.replace('\n', '')
</code></pre>
<p>will do the job. <code>'\n'</code> is a universal end of line character in python.</p>
| 0 | 2009-08-08T20:20:54Z | [
"python",
"string",
"line-breaks"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.