title stringlengths 12 150 | question_id int64 469 40.1M | question_score int64 2 5.52k | question_date stringdate 2008-08-02 15:11:16 2016-10-18 06:16:31 | answer_id int64 536 40.1M | answer_score int64 7 8.38k | answer_date stringdate 2008-08-02 18:49:07 2016-10-18 06:19:33 | tags listlengths 1 5 | question_body_md stringlengths 15 30.2k | answer_body_md stringlengths 11 27.8k |
|---|---|---|---|---|---|---|---|---|---|
What is a metaclass in Python? | 100,003 | 3,219 | 2008-09-19T06:10:46Z | 31,930,795 | 38 | 2015-08-10T23:28:09Z | [
"python",
"oop",
"metaclass",
"python-datamodel"
] | What are metaclasses? What do you use them for? | > # What are metaclasses? What do you use them for?
A class is to an instance as a metaclass is to a class.
Put another way, a class is an instance of a metaclass.
Put a third way, a metaclass is a class's class.
Still hopelessly confused? So was I, until I learned the following and demonstrated how one can actuall... |
What is a metaclass in Python? | 100,003 | 3,219 | 2008-09-19T06:10:46Z | 35,732,111 | 23 | 2016-03-01T19:48:34Z | [
"python",
"oop",
"metaclass",
"python-datamodel"
] | What are metaclasses? What do you use them for? | **Python 3 update**
There are (at this point) two key methods in a metaclass:
* `__prepare__`, and
* `__new__`
`__prepare__` lets you supply a custom mapping (such as an `OrderedDict`) to be used as the namespace while the class is being created. You must return an instance of whatever namespace you choose. If you d... |
What is the standard way to add N seconds to datetime.time in Python? | 100,210 | 188 | 2008-09-19T07:19:36Z | 100,345 | 281 | 2008-09-19T07:54:39Z | [
"python",
"datetime",
"time",
"math"
] | Given a `datetime.time` value in Python, is there a standard way to add an integer number of seconds to it, so that `11:34:59` + 3 = `11:35:02`, for example?
These obvious ideas don't work:
```
>>> datetime.time(11, 34, 59) + 3
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int'
>>> datetime.time(... | You can use full `datetime` variables with `timedelta`, and by providing a dummy date then using `time` to just get the time value.
For example:
```
import datetime
a = datetime.datetime(100,1,1,11,34,59)
b = a + datetime.timedelta(0,3) # days, seconds, then other fields.
print a.time()
print b.time()
```
results in... |
What is the standard way to add N seconds to datetime.time in Python? | 100,210 | 188 | 2008-09-19T07:19:36Z | 100,404 | 9 | 2008-09-19T08:08:10Z | [
"python",
"datetime",
"time",
"math"
] | Given a `datetime.time` value in Python, is there a standard way to add an integer number of seconds to it, so that `11:34:59` + 3 = `11:35:02`, for example?
These obvious ideas don't work:
```
>>> datetime.time(11, 34, 59) + 3
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int'
>>> datetime.time(... | One little thing, might add clarity to override the default value for seconds
```
>>> b = a + datetime.timedelta(seconds=3000)
>>> b
datetime.datetime(1, 1, 1, 12, 24, 59)
``` |
What is the standard way to add N seconds to datetime.time in Python? | 100,210 | 188 | 2008-09-19T07:19:36Z | 100,776 | 7 | 2008-09-19T09:40:06Z | [
"python",
"datetime",
"time",
"math"
] | Given a `datetime.time` value in Python, is there a standard way to add an integer number of seconds to it, so that `11:34:59` + 3 = `11:35:02`, for example?
These obvious ideas don't work:
```
>>> datetime.time(11, 34, 59) + 3
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int'
>>> datetime.time(... | Thanks to @[Pax Diablo](#100345), @bvmou and @Arachnid for the suggestion of using full datetimes throughout. If I have to accept datetime.time objects from an external source, then this seems to be an alternative `add_secs_to_time()` function:
```
def add_secs_to_time(timeval, secs_to_add):
dummy_date = datetime.... |
What is the standard way to add N seconds to datetime.time in Python? | 100,210 | 188 | 2008-09-19T07:19:36Z | 101,947 | 34 | 2008-09-19T13:47:29Z | [
"python",
"datetime",
"time",
"math"
] | Given a `datetime.time` value in Python, is there a standard way to add an integer number of seconds to it, so that `11:34:59` + 3 = `11:35:02`, for example?
These obvious ideas don't work:
```
>>> datetime.time(11, 34, 59) + 3
TypeError: unsupported operand type(s) for +: 'datetime.time' and 'int'
>>> datetime.time(... | As others here have stated, you can just use full datetime objects throughout:
```
sometime = get_some_time() # the time to which you want to add 3 seconds
later = (datetime.combine(date.today(), sometime) + timedelta(seconds=3)).time()
```
However, I think it's worth explaining why full datetime objects are required... |
How can I analyze Python code to identify problematic areas? | 100,298 | 91 | 2008-09-19T07:40:22Z | 100,394 | 17 | 2008-09-19T08:05:48Z | [
"python",
"static-analysis",
"cyclomatic-complexity"
] | I have a large source repository split across multiple projects. I would like to produce a report about the health of the source code, identifying problem areas that need to be addressed.
Specifically, I'd like to call out routines with a high cyclomatic complexity, identify repetition, and perhaps run some lint-like ... | For static analysis there is [pylint](http://www.logilab.org/857) and [pychecker](http://pychecker.sourceforge.net/). Personally I use pylint as it seems to be more comprehensive than pychecker.
For cyclomatic complexity you can try [this perl program](http://www.journyx.com/curt/complexity.html), or this [article](ht... |
How can I analyze Python code to identify problematic areas? | 100,298 | 91 | 2008-09-19T07:40:22Z | 105,473 | 29 | 2008-09-19T20:44:22Z | [
"python",
"static-analysis",
"cyclomatic-complexity"
] | I have a large source repository split across multiple projects. I would like to produce a report about the health of the source code, identifying problem areas that need to be addressed.
Specifically, I'd like to call out routines with a high cyclomatic complexity, identify repetition, and perhaps run some lint-like ... | For measuring cyclomatic complexity, there's a nice tool available at [traceback.org](http://www.traceback.org/2008/03/31/measuring-cyclomatic-complexity-of-python-code/). The page also gives a good overview of how to interpret the results.
+1 for [pylint](http://www.logilab.org/project/pylint). It is great at verifyi... |
How can I analyze Python code to identify problematic areas? | 100,298 | 91 | 2008-09-19T07:40:22Z | 2,799,127 | 11 | 2010-05-09T20:50:34Z | [
"python",
"static-analysis",
"cyclomatic-complexity"
] | I have a large source repository split across multiple projects. I would like to produce a report about the health of the source code, identifying problem areas that need to be addressed.
Specifically, I'd like to call out routines with a high cyclomatic complexity, identify repetition, and perhaps run some lint-like ... | Pycana works like charm when you need to understand a new project!
> [PyCAna](http://sourceforge.net/projects/pycana/) (Python Code Analyzer) is
> a fancy name for a simple code
> analyzer for python that creates a
> class diagram after executing your
> code.
See how it works:
<http://pycana.sourceforge.net/>
output... |
How can I analyze Python code to identify problematic areas? | 100,298 | 91 | 2008-09-19T07:40:22Z | 14,793,812 | 24 | 2013-02-10T01:47:31Z | [
"python",
"static-analysis",
"cyclomatic-complexity"
] | I have a large source repository split across multiple projects. I would like to produce a report about the health of the source code, identifying problem areas that need to be addressed.
Specifically, I'd like to call out routines with a high cyclomatic complexity, identify repetition, and perhaps run some lint-like ... | For cyclomatic complexity you can use `radon`: <https://github.com/rubik/radon>
(Use `pip` to install it: `pip install radon`)
Additionally it also has these features:
* raw metrics (these include SLOC, comment lines, blank lines, &c.)
* Halstead metrics (all of them)
* Maintainability Index (the one used in Visual ... |
Python on Windows - how to wait for multiple child processes? | 100,624 | 20 | 2008-09-19T09:02:43Z | 100,886 | 12 | 2008-09-19T10:09:47Z | [
"python",
"windows",
"asynchronous"
] | How to wait for multiple child processes in Python on Windows, without active wait (polling)? Something like this *almost* works for me:
```
proc1 = subprocess.Popen(['python','mytest.py'])
proc2 = subprocess.Popen(['python','mytest.py'])
proc1.wait()
print "1 finished"
proc2.wait()
print "2 finished"
```
The pro... | It might seem overkill, but, here it goes:
```
import Queue, thread, subprocess
results= Queue.Queue()
def process_waiter(popen, description, que):
try: popen.wait()
finally: que.put( (description, popen.returncode) )
process_count= 0
proc1= subprocess.Popen( ['python', 'mytest.py'] )
thread.start_new_thread... |
Why is "if not someobj:" better than "if someobj == None:" in Python? | 100,732 | 82 | 2008-09-19T09:29:19Z | 100,762 | 139 | 2008-09-19T09:38:10Z | [
"python"
] | I've seen several examples of code like this:
```
if not someobj:
#do something
```
But I'm wondering why not doing:
```
if someobj == None:
#do something
```
Is there any difference? Does one have an advantage over the other? | In the first test, Python try to convert the object to a `bool` value if it is not already one. Roughly, **we are asking the object : are you meaningful or not ?** This is done using the following algorithm :
1. If the object has a `__nonzero__` special method (as do numeric built-ins, `int` and `float`), it calls thi... |
Why is "if not someobj:" better than "if someobj == None:" in Python? | 100,732 | 82 | 2008-09-19T09:29:19Z | 100,764 | 30 | 2008-09-19T09:38:26Z | [
"python"
] | I've seen several examples of code like this:
```
if not someobj:
#do something
```
But I'm wondering why not doing:
```
if someobj == None:
#do something
```
Is there any difference? Does one have an advantage over the other? | Because `None` is not the only thing that is considered false.
```
if not False:
print "False is false."
if not 0:
print "0 is false."
if not []:
print "An empty list is false."
if not ():
print "An empty tuple is false."
if not {}:
print "An empty dict is false."
if not "":
print "An empty str... |
Why is "if not someobj:" better than "if someobj == None:" in Python? | 100,732 | 82 | 2008-09-19T09:29:19Z | 100,903 | 39 | 2008-09-19T10:12:34Z | [
"python"
] | I've seen several examples of code like this:
```
if not someobj:
#do something
```
But I'm wondering why not doing:
```
if someobj == None:
#do something
```
Is there any difference? Does one have an advantage over the other? | These are actually both poor practices. Once upon a time, it was considered OK to casually treat None and False as similar. However, since Python 2.2 this is not the best policy.
First, when you do an `if x` or `if not x` kind of test, Python has to implicitly convert `x` to boolean. The rules for the `bool` function ... |
Building Python C extension modules for Windows | 101,061 | 10 | 2008-09-19T10:53:12Z | 101,087 | 13 | 2008-09-19T10:57:36Z | [
"python",
"windows"
] | I have a C extension module and it would be nice to distribute built binaries. Setuptools makes it easy to build extensions modules on OS X and GNU/Linux, since those OSs come with GCC, but I don't know how to do it in Windows.
Would I need to buy a copy of Visual Studio, or does Visual Studio Express work? Can I just... | You can use both MinGW and VC++ Express (free, no need to buy it).
See:
1. <http://eli.thegreenplace.net/2008/06/28/compiling-python-extensions-with-distutils-and-mingw/>
2. <http://eli.thegreenplace.net/2008/06/27/creating-python-extension-modules-in-c/> |
How do I read text from the (windows) clipboard from python? | 101,128 | 44 | 2008-09-19T11:09:27Z | 101,167 | 47 | 2008-09-19T11:20:29Z | [
"python",
"windows"
] | How do I read text from the (windows) clipboard from python? | You can use the module called [win32clipboard](http://docs.activestate.com/activepython/2.5/pywin32/win32clipboard.html), which is part of [pywin32](http://sourceforge.net/projects/pywin32/).
Here is an example that first sets the clipboard data then gets it:
```
import win32clipboard
# set clipboard data
win32clipb... |
How do I read text from the (windows) clipboard from python? | 101,128 | 44 | 2008-09-19T11:09:27Z | 8,039,424 | 18 | 2011-11-07T16:27:31Z | [
"python",
"windows"
] | How do I read text from the (windows) clipboard from python? | I've seen many suggestions to use the win32 module, but Tkinter provides the shortest and easiest method I've seen, as in this post: [How do I copy a string to the clipboard on Windows using Python?](http://stackoverflow.com/questions/579687/how-do-i-copy-a-string-to-the-clipboard-on-windows-using-python/4203897#420389... |
How do I read text from the (windows) clipboard from python? | 101,128 | 44 | 2008-09-19T11:09:27Z | 11,096,779 | 10 | 2012-06-19T08:00:02Z | [
"python",
"windows"
] | How do I read text from the (windows) clipboard from python? | The most upvoted answer above is weird in a way that it simply clears the Clipboard and then gets the content (which is then empty). One could clear the clipboard to be sure that some clipboard content type like "formated text" does not "cover" your plain text content you want to save in the clipboard.
The following p... |
How do I read text from the (windows) clipboard from python? | 101,128 | 44 | 2008-09-19T11:09:27Z | 23,844,754 | 10 | 2014-05-24T11:58:36Z | [
"python",
"windows"
] | How do I read text from the (windows) clipboard from python? | you can easily get this done through the built-in module [Tkinter](https://docs.python.org/2/library/tkinter.html) which is basically a GUI library. This code creates a blank widget to get the clipboard content from OS.
```
#from tkinter import Tk # Python 3
from Tkinter import Tk
Tk().clipboard_get()
``` |
Is there a zip-like method in .Net? | 101,174 | 12 | 2008-09-19T11:21:57Z | 101,222 | 25 | 2008-09-19T11:34:43Z | [
".net",
"python",
"list",
"iteration"
] | In Python there is a really neat function called `zip` which can be used to iterate through two lists at the same time:
```
list1 = [1, 2, 3]
list2 = ["a", "b", "c"]
for v1, v2 in zip(list1, list2):
print v1 + " " + v2
```
The above code shoul produce the following:
```
1 a
2 b
3 c
```
I wonder if there is a me... | Update: It is built-in in C# 4 as [System.Linq.Enumerable.Zip Method](https://msdn.microsoft.com/en-us/library/vstudio/dd267698(v=vs.110).aspx)
Here is a C# 3 version:
```
IEnumerable<TResult> Zip<TResult,T1,T2>
(IEnumerable<T1> a,
IEnumerable<T2> b,
Func<T1,T2,TResult> combine)
{
using (var f = a.G... |
Is there a zip-like method in .Net? | 101,174 | 12 | 2008-09-19T11:21:57Z | 101,227 | 8 | 2008-09-19T11:35:28Z | [
".net",
"python",
"list",
"iteration"
] | In Python there is a really neat function called `zip` which can be used to iterate through two lists at the same time:
```
list1 = [1, 2, 3]
list2 = ["a", "b", "c"]
for v1, v2 in zip(list1, list2):
print v1 + " " + v2
```
The above code shoul produce the following:
```
1 a
2 b
3 c
```
I wonder if there is a me... | As far as I know there is not. I wrote one for myself (as well as a few other useful extensions and put them in a project called [NExtension](http://www.codeplex.com/nextension) on Codeplex.
Apparently the Parallel extensions for .NET have a Zip function.
Here's a simplified version from NExtension (but please check ... |
How do you access an authenticated Google App Engine service from a (non-web) python client? | 101,742 | 49 | 2008-09-19T13:19:09Z | 102,509 | 38 | 2008-09-19T14:55:24Z | [
"python",
"web-services",
"google-app-engine",
"authentication"
] | I have a Google App Engine app - <http://mylovelyapp.appspot.com/>
It has a page - mylovelypage
For the moment, the page just does `self.response.out.write('OK')`
If I run the following Python at my computer:
```
import urllib2
f = urllib2.urlopen("http://mylovelyapp.appspot.com/mylovelypage")
s = f.read()
print s
f... | appcfg.py, the tool that uploads data to App Engine has to do exactly this to authenticate itself with the App Engine server. The relevant functionality is abstracted into appengine\_rpc.py. In a nutshell, the solution is:
1. Use the [Google ClientLogin API](http://code.google.com/apis/accounts/docs/AuthForInstalledAp... |
How do you access an authenticated Google App Engine service from a (non-web) python client? | 101,742 | 49 | 2008-09-19T13:19:09Z | 103,410 | 34 | 2008-09-19T16:22:06Z | [
"python",
"web-services",
"google-app-engine",
"authentication"
] | I have a Google App Engine app - <http://mylovelyapp.appspot.com/>
It has a page - mylovelypage
For the moment, the page just does `self.response.out.write('OK')`
If I run the following Python at my computer:
```
import urllib2
f = urllib2.urlopen("http://mylovelyapp.appspot.com/mylovelypage")
s = f.read()
print s
f... | thanks to Arachnid for the answer - it worked as suggested
here is a simplified copy of the code, in case it is helpful to the next person to try!
```
import os
import urllib
import urllib2
import cookielib
users_email_address = "[email protected]"
users_password = "billybobspassword"
target_authenticated_go... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 101,787 | 20 | 2008-09-19T13:26:53Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | Not at the moment and you would be lucky to get Jython to work soon. If you're planning to start your development now you would be better off with just sticking to Java for now on. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 256,069 | 40 | 2008-11-01T20:29:44Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | As a [Python](http://en.wikipedia.org/wiki/Python_%28programming_language%29) lover and Android programmer, I am sad to say this is not really a good way to go. There are two problems.
One problem is that there is a lot more than just a programming language to the Android development tools. A lot of the Android graphi... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 383,473 | 37 | 2008-12-20T16:56:57Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | I just posted some [directions for cross compiling Python 2.4.5 for Android](http://www.damonkohler.com/2008/12/python-on-android.html). It takes some patching, and not all modules are supported, but the basics are there. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 973,765 | 143 | 2009-06-10T05:13:13Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | [YES!](http://google-opensource.blogspot.com/2009/06/introducing-android-scripting.html)
An example [via Matt Cutts](http://www.mattcutts.com/blog/android-barcode-scanner/) -- "hereâs a barcode scanner written in six lines of Python code:
```
import android
droid = android.Android()
code = droid.scanBarcode()
isbn ... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 973,786 | 248 | 2009-06-10T05:24:29Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | There is also the new [Android Scripting Environment](http://www.talkandroid.com/1225-android-scripting-environment/) (ASE) project. It looks awesome, and it has some integration with native Android components. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 4,381,935 | 16 | 2010-12-07T21:46:18Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | Check out the blog post <http://www.saffirecorp.com/?p=113> that explains how to install and run [Python](http://en.wikipedia.org/wiki/Python_%28programming_language%29) and a simple webserver written in Python on Android. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 4,828,127 | 54 | 2011-01-28T12:18:47Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | *"The [Pygame Subset for Android](http://www.renpy.org/pygame/) is a port of a subset of Pygame functionality to the Android platform. The goal of the project is to allow the creation of Android-specific games, and to ease the porting of games from PC-like platforms to Android."*
The examples include a complete game p... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 5,475,949 | 7 | 2011-03-29T16:42:06Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | There's also python-on-a-chip possibly running mosync: [google group](http://groups.google.com/group/python-on-a-chip/browse_thread/thread/df1c837bae2200f2/02992219b9c0003e?lnk=gst&q=mosync#02992219b9c0003e) |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 6,136,305 | 54 | 2011-05-26T09:21:31Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | There's also [SL4A](https://github.com/damonkohler/sl4a) written by a Google employee. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 7,741,114 | 50 | 2011-10-12T13:49:09Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | I've posted instructions and a patch for cross compiling Python 2.7.2 for Android, you can get it at my blog here: <http://mdqinc.com/blog/2011/09/cross-compiling-python-for-android/>
EDIT: I've open sourced [Ignifuga](http://ignifuga.org), my 2D Game Engine, it's Python/SDL based and it cross compiles for Android. Ev... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 8,189,603 | 539 | 2011-11-18T21:49:45Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | One way is to use [Kivy](http://kivy.org/):
> Open source Python library for rapid development of applications
> that make use of innovative user interfaces, such as multi-touch apps.
> Kivy runs on Linux, Windows, OS X, Android and iOS. You can run the same [python] code on all supported platforms.
[Kivy Showcase a... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 8,759,409 | 18 | 2012-01-06T14:34:25Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | Using SL4A (which has already been mentioned by itself in other answers) you can [run](http://groups.google.com/group/web2py/browse_thread/thread/f227e93fe802a902) a full-blown [web2py](http://web2py.com/) instance (other [python web frameworks](http://wiki.python.org/moin/WebFrameworks) are likely candidates as well).... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 8,784,038 | 12 | 2012-01-09T04:46:53Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | From the [Python for android](https://github.com/kivy/python-for-android) site:
> Python for android is a project to create your own Python distribution including the modules you want, and create an apk including python, libs, and your application. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 9,773,282 | 34 | 2012-03-19T15:45:27Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | ### SL4A
[Scripting Layer for Android](https://github.com/damonkohler/sl4a) does what you want. You can easily install it directly onto your device from their site, and do not need root.
It supports a range of languages; Python is the most mature. By default, it uses Python 2.6, but there is a [3.2 port](https://code... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 10,519,481 | 12 | 2012-05-09T15:44:49Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | Yet another attempt: <https://code.google.com/p/android-python27/>
This one embed directly the Python interpretter in your app apk. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 15,335,213 | 8 | 2013-03-11T09:36:58Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | You can run your Python code using [sl4a](http://code.google.com/p/android-scripting/). sl4a supports Python, [Perl](http://en.wikipedia.org/wiki/Perl), [JRuby](http://en.wikipedia.org/wiki/JRuby), [Lua](http://en.wikipedia.org/wiki/Lua_%28programming_language%29), BeanShell, JavaScript, [Tcl](http://en.wikipedia.org/w... |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 17,073,989 | 14 | 2013-06-12T19:46:35Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | I use the QPython application. It has an editor, a console, and you can run your Python programs with it. The application is free, and the link is <http://qpython.com/>. |
Is there a way to run Python on Android? | 101,754 | 1,360 | 2008-09-19T13:21:12Z | 27,913,916 | 13 | 2015-01-13T02:08:57Z | [
"python",
"android",
"ase",
"android-scripting"
] | We are working on an [S60](http://en.wikipedia.org/wiki/S60_%28software_platform%29) version and this platform has a nice Python API.
However, there is nothing official about Python on Android, but since [Jython](http://en.wikipedia.org/wiki/Jython) exists, is there a way to let the snake and the robot work together? | # Kivy
---
I want to post this as an extension to what **@JohnMudd** has already answered (*but please bare with me as English isn't my first language*)
It has been years since then, and **Kivy** has also *evoluted* to **v1.9-dev**, the biggest selling point of **Kivy** in my opinion is its cross-platform compatibil... |
Sorting a dict on __iter__ | 102,394 | 4 | 2008-09-19T14:43:24Z | 102,443 | 8 | 2008-09-19T14:49:06Z | [
"python",
"optimization",
"refactoring"
] | I am trying to sort a dict based on its key and return an iterator to the values from within an overridden iter method in a class. Is there a nicer and more efficient way of doing this than creating a new list, inserting into the list as I sort through the keys? | How about something like this:
```
def itersorted(d):
for key in sorted(d):
yield d[key]
``` |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,612 | 34 | 2008-09-19T15:07:13Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | See the "Motivation" section in [PEP 255](http://www.python.org/dev/peps/pep-0255/).
A non-obvious use of generators is creating interruptible functions, which lets you do things like update UI or run several jobs "simultaneously" (interleaved, actually) while not using threads. |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,632 | 183 | 2008-09-19T15:09:25Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | Generators give you lazy evaluation. You use them by iterating over them, either explicitly with 'for' or implicitly by passing it to any function or construct that iterates. You can think of generators as returning multiple items, as if they return a list, but instead of returning them all at once they return them one... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,634 | 71 | 2008-09-19T15:09:28Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | One of the reasons to use generator is to make the solution clearer for some kind of solutions.
The other is to treat results one at a time, avoiding building huge lists of results that you would process separated anyway.
If you have a fibonacci-up-to-n function like this:
```
# function version
def fibon(n):
a ... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,667 | 12 | 2008-09-19T15:13:16Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | My favorite uses are "filter" and "reduce" operations.
Let's say we're reading a file, and only want the lines which begin with "##".
```
def filter2sharps( aSequence ):
for l in aSequence:
if l.startswith("##"):
yield l
```
We can then use the generator function in a proper loop
```
source=... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,674 | 26 | 2008-09-19T15:14:10Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | Buffering. When it is efficient to fetch data in large chunks, but process it in small chunks, then a generator might help:
```
def bufferedFetch():
while True:
buffer = getBigChunkOfData()
# insert some code to break on 'end of data'
for i in buffer:
yield i
```
The above lets you easi... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 102,682 | 17 | 2008-09-19T15:15:03Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | The simple explanation:
Consider a `for` statement
```
for item in iterable:
do_stuff()
```
A lot of the time, all the items in `iterable` doesn't need to be there from the start, but can be generated on the fly as they're required. This can be a lot more efficient in both
* space (you never need to store all the... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 740,763 | 17 | 2009-04-11T20:55:59Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | I have found that generators are very helpful in cleaning up your code and by giving you a very unique way to encapsulate and modularize code. In a situation where you need something to constantly spit out values based on its own internal processing and when that something needs to be called from anywhere in your code ... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 14,394,854 | 22 | 2013-01-18T08:17:56Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | I find this explanation which clears my doubt. Because there is a possibility that person who don't know `Generators` also don't know about `yield`
**Return**
The return statement is where all the local variables are destroyed and the resulting value is given back (returned) to the caller. Should the same function be... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 23,530,101 | 17 | 2014-05-07T23:20:11Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | ## Real World Example
Lets say you have 100 million domains in your MySQL table and you would like to update alexa rank for each domain.
First thing you need is to select your domain names from the database.
Lets say your database name is `domains` and table name is `domain`
If you use `SELECT domain FROM domains` ... |
What can you use Python generator functions for? | 102,535 | 157 | 2008-09-19T14:58:49Z | 26,074,771 | 7 | 2014-09-27T12:40:27Z | [
"python",
"generator"
] | I'm starting to learn Python and I've come across generator functions, those that have a yield statement in them. I want to know what types of problems that these functions are really good at solving. | A practical example where you could make use of a generator is if you have some kind of shape and you want to iterate over its corners, edges or whatever. For my own project (source code [here](https://github.com/Pithikos/python-rectangles)) I had a rectangle:
```
class Rect():
def __init__(self, x, y, width, hei... |
How do I merge a 2D array in Python into one string with List Comprehension? | 103,844 | 14 | 2008-09-19T17:21:53Z | 103,895 | 22 | 2008-09-19T17:28:14Z | [
"python",
"list-comprehension"
] | List Comprehension for me seems to be like the opaque block of granite that regular expressions are for me. I need pointers.
Say, I have a 2D list:
```
li = [[0,1,2],[3,4,5],[6,7,8]]
```
I would like to merge this either into one long list
```
li2 = [0,1,2,3,4,5,6,7,8]
```
or into a string with separators:
```
s ... | Like so:
```
[ item for innerlist in outerlist for item in innerlist ]
```
Turning that directly into a string with separators:
```
','.join(str(item) for innerlist in outerlist for item in innerlist)
```
Yes, the order of 'for innerlist in outerlist' and 'for item in innerlist' is correct. Even though the "body" o... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 104,426 | 15 | 2008-09-19T18:41:52Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | This solution implements a generator, to avoid holding all the permutations on memory:
```
def permutations (orig_list):
if not isinstance(orig_list, list):
orig_list = list(orig_list)
yield orig_list
if len(orig_list) == 1:
return
for n in sorted(orig_list):
new_list = orig_... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 104,436 | 190 | 2008-09-19T18:43:09Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | **Starting with Python 2.6** (and if you're on Python 3) you have a **standard-library** tool for this: [`itertools.permutations`](https://docs.python.org/2/library/itertools.html#itertools.permutations).
---
If you're using an **older Python (<2.6)** for some reason or are just curious to know how it works, here's o... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 104,471 | 255 | 2008-09-19T18:48:48Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | And in [Python 2.6](http://docs.python.org/dev/whatsnew/2.6.html) onwards:
```
import itertools
itertools.permutations([1,2,3])
```
(returned as a generator. Use `list(permutations(l))` to return as a list.) |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 108,651 | 10 | 2008-09-20T16:32:47Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | The following code is an in-place permutation of a given list, implemented as a generator. Since it only returns references to the list, the list should not be modified outside the generator.
The solution is non-recursive, so uses low memory. Work well also with multiple copies of elements in the input list.
```
def p... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 170,248 | 177 | 2008-10-04T12:18:56Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | *The following code with Python 2.6 and above ONLY*
First, import `itertools`:
```
import itertools
```
### Permutation (order matters):
```
print list(itertools.permutations([1,2,3,4], 2))
[(1, 2), (1, 3), (1, 4),
(2, 1), (2, 3), (2, 4),
(3, 1), (3, 2), (3, 4),
(4, 1), (4, 2), (4, 3)]
```
### Combination (order d... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 5,501,066 | 8 | 2011-03-31T13:58:40Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | A quite obvious way in my opinion might be also:
```
def permutList(l):
if not l:
return [[]]
res = []
for e in l:
temp = l[:]
temp.remove(e)
res.extend([[e] + r for r in permutList(temp)])
return res
``` |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 7,140,205 | 7 | 2011-08-21T18:28:44Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | ```
list2Perm = [1, 2.0, 'three']
listPerm = [[a, b, c]
for a in list2Perm
for b in list2Perm
for c in list2Perm
if ( a != b and b != c and a != c )
]
print listPerm
```
Output:
```
[
[1, 2.0, 'three'],
[1, 'three', 2.0],
[2.0, 1, 'three'],
... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 7,733,966 | 23 | 2011-10-12T00:14:09Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | ```
def permutations(head, tail=''):
if len(head) == 0: print tail
else:
for i in range(len(head)):
permutations(head[0:i] + head[i+1:], tail+head[i])
```
called as:
```
permutations('abc')
``` |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 11,962,517 | 11 | 2012-08-14T23:58:40Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | ```
#!/usr/bin/env python
def perm(a,k=0):
if(k==len(a)):
print a
else:
for i in xrange(k,len(a)):
a[k],a[i] = a[i],a[k]
perm(a, k+1)
a[k],a[i] = a[i],a[k]
perm([1,2,3])
```
Output:
```
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 2, 1]
[3, 1, 2]
```
As I'm swapping the ... |
How to generate all permutations of a list in Python | 104,420 | 271 | 2008-09-19T18:41:03Z | 17,391,851 | 7 | 2013-06-30T15:17:16Z | [
"python",
"algorithm",
"permutation",
"combinatorics",
"python-2.5"
] | How do you generate all the permutations of a list in Python, independently of the type of elements in that list?
For example:
```
permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
```
EDIT:
Eliben point... | In a functional style
```
def addperm(x,l):
return [ l[0:i] + [x] + l[i:] for i in range(len(l)+1) ]
def perm(l):
if len(l) == 0:
return [[]]
return [x for y in perm(l[1:]) for x in addperm(l[0],y) ]
print perm([ i for i in range(3)])
```
The result:
```
[[0, 1, 2], [1, 0, 2], [1, 2, 0], [0, 2... |
What is "thread local storage" in Python, and why do I need it? | 104,983 | 62 | 2008-09-19T19:53:19Z | 105,025 | 48 | 2008-09-19T19:59:40Z | [
"python",
"multithreading",
"thread-local"
] | In Python specifically, how do variables get shared between threads?
Although I have used `threading.Thread` before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage t... | In Python, everything is shared, except for function-local variables (because each function call gets its own set of locals, and threads are always separate function calls.) And even then, only the variables themselves (the names that refer to objects) are local to the function; objects themselves are always global, an... |
What is "thread local storage" in Python, and why do I need it? | 104,983 | 62 | 2008-09-19T19:53:19Z | 106,560 | 13 | 2008-09-20T00:31:24Z | [
"python",
"multithreading",
"thread-local"
] | In Python specifically, how do variables get shared between threads?
Although I have used `threading.Thread` before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage t... | You can create thread local storage using `threading.local()`.
```
>>> tls = threading.local()
>>> tls.x = 4
>>> tls.x
4
```
Data stored to the tls will be unique to each thread which will help ensure that unintentional sharing does not occur. |
What is "thread local storage" in Python, and why do I need it? | 104,983 | 62 | 2008-09-19T19:53:19Z | 1,894,371 | 44 | 2009-12-12T18:58:50Z | [
"python",
"multithreading",
"thread-local"
] | In Python specifically, how do variables get shared between threads?
Although I have used `threading.Thread` before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage t... | Consider the following code:
```
#/usr/bin/env python
from time import sleep
from random import random
from threading import Thread, local
data = local()
def bar():
print "I'm called from", data.v
def foo():
bar()
class T(Thread):
def run(self):
sleep(random())
data.v = self.getName() ... |
Are locks unnecessary in multi-threaded Python code because of the GIL? | 105,095 | 51 | 2008-09-19T20:07:37Z | 105,145 | 20 | 2008-09-19T20:13:54Z | [
"python",
"multithreading",
"locking"
] | If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?
If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?
sorry if this is a dumb questi... | No - the GIL just protects python internals from multiple threads altering their state. This is a very low-level of locking, sufficient only to keep python's own structures in a consistent state. It doesn't cover the *application* level locking you'll need to do to cover thread safety in your own code.
The essence of ... |
Are locks unnecessary in multi-threaded Python code because of the GIL? | 105,095 | 51 | 2008-09-19T20:07:37Z | 105,272 | 7 | 2008-09-19T20:24:50Z | [
"python",
"multithreading",
"locking"
] | If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?
If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?
sorry if this is a dumb questi... | The Global Interpreter Lock prevents threads from accessing the *interpreter* simultaneously (thus CPython only ever uses one core). However, as I understand it, the threads are still interrupted and scheduled *preemptively*, which means you still need locks on shared data structures, lest your threads stomp on each ot... |
Are locks unnecessary in multi-threaded Python code because of the GIL? | 105,095 | 51 | 2008-09-19T20:07:37Z | 105,369 | 57 | 2008-09-19T20:34:40Z | [
"python",
"multithreading",
"locking"
] | If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?
If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?
sorry if this is a dumb questi... | You will still need locks if you share state between threads. The GIL only protects the interpreter internally. You can still have inconsistent updates in your own code.
For example:
```
#!/usr/bin/env python
import threading
shared_balance = 0
class Deposit(threading.Thread):
def run(self):
for _ in xr... |
Are locks unnecessary in multi-threaded Python code because of the GIL? | 105,095 | 51 | 2008-09-19T20:07:37Z | 241,814 | 7 | 2008-10-28T00:16:12Z | [
"python",
"multithreading",
"locking"
] | If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?
If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?
sorry if this is a dumb questi... | Adding to the discussion:
Because the GIL exists, some operations are atomic in Python and do not need a lock.
<http://www.python.org/doc/faq/library/#what-kinds-of-global-value-mutation-are-thread-safe>
As stated by the other answers, however, you *still* need to use locks whenever the application logic requires th... |
Making a beta code for a public django site | 105,702 | 11 | 2008-09-19T21:17:20Z | 106,212 | 18 | 2008-09-19T22:43:40Z | [
"python",
"django",
"authentication",
"django-authentication"
] | I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django.
I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particularly that the security of the beta code is iron-clad, just th... | Start with [this Django snippet](http://www.djangosnippets.org/snippets/136/), but modify it to check `request.session['has_beta_access']`. If they don't have it, then have it return a redirect to a "enter beta code" page that, when posted to with the right code, sets that session variable to `True`.
Making it a publi... |
Why unicode() uses str() on my object only with no encoding given? | 106,630 | 5 | 2008-09-20T00:53:24Z | 106,709 | 7 | 2008-09-20T01:32:09Z | [
"python",
"unicode",
"encoding"
] | I start by creating a string variable with some **non-ascii** *utf-8* encoded data on it:
```
>>> text = 'á'
>>> text
'\xc3\xa1'
>>> text.decode('utf-8')
u'\xe1'
```
Using `unicode()` on it raises errors...
```
>>> unicode(text)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeE... | The behaviour does seem confusing, but intensional. I reproduce here the entirety of the unicode documentation from the [Python Built-In Functions documentation](http://docs.python.org/lib/built-in-funcs.html) (for version 2.5.2, as I write this):
> **unicode([object[, encoding [, errors]]])**
>
> Return the Unicode s... |
How to bundle a Python application including dependencies? | 106,725 | 43 | 2008-09-20T01:39:48Z | 106,730 | 25 | 2008-09-20T01:41:20Z | [
"python",
"tkinter",
"packaging"
] | I need to package my python application, its dependencies and python into a single MSI installer. The end result should desirably be:
* Python is installed in the standard location
* the package and its dependencies are installed in a separate directory (possibly site-packages)
* the installation directory should cont... | Kind of a dup of this question about [how to make a python into an executable](http://stackoverflow.com/questions/2933/an-executable-python-app).
It boils down to:
[py2exe](http://www.py2exe.org/) on windows, [Freeze](http://wiki.python.org/moin/Freeze) on Linux, and
[py2app](http://svn.pythonmac.org/py2app/py2app/t... |
How to bundle a Python application including dependencies? | 106,725 | 43 | 2008-09-20T01:39:48Z | 106,756 | 13 | 2008-09-20T01:52:20Z | [
"python",
"tkinter",
"packaging"
] | I need to package my python application, its dependencies and python into a single MSI installer. The end result should desirably be:
* Python is installed in the standard location
* the package and its dependencies are installed in a separate directory (possibly site-packages)
* the installation directory should cont... | I use [PyInstaller](http://pyinstaller.python-hosting.com/) (the svn version) to create a stand-alone version of my program that includes Python and all the dependencies. It takes a little fiddling to get it to work right and include everything (as does py2exe and other similar programs, see [this question](http://stac... |
Unit Testing File Modifications | 106,766 | 22 | 2008-09-20T01:56:25Z | 111,199 | 14 | 2008-09-21T15:16:34Z | [
"python",
"linux",
"unit-testing"
] | A common task in programs I've been working on lately is modifying a text file in some way. (Hey, I'm on Linux. Everything's a file. And I do large-scale system admin.)
But the file the code modifies may not exist on my desktop box. And I probably don't want to modify it if it IS on my desktop.
I've read about unit t... | You're talking about testing too much at once. If you start trying to attack a testing problem by saying "Let's verify that it modifies its environment correctly", you're doomed to failure. Environments have dozens, maybe even millions of potential variations.
Instead, look at the pieces ("units") of your program. For... |
How do you send a HEAD HTTP request in Python 2? | 107,405 | 97 | 2008-09-20T06:38:38Z | 107,427 | 94 | 2008-09-20T06:45:45Z | [
"python",
"python-2.7",
"http",
"http-headers",
"content-type"
] | What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if `http://somedomain/foo/` will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download ... | **edit**: This answer works, but nowadays you should just use the [requests](http://docs.python-requests.org/en/latest/index.html) library as mentioned by other answers below.
---
Use [httplib](https://docs.python.org/2/library/httplib.html).
```
>>> import httplib
>>> conn = httplib.HTTPConnection("www.google.com")... |
How do you send a HEAD HTTP request in Python 2? | 107,405 | 97 | 2008-09-20T06:38:38Z | 2,070,916 | 99 | 2010-01-15T10:50:52Z | [
"python",
"python-2.7",
"http",
"http-headers",
"content-type"
] | What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if `http://somedomain/foo/` will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download ... | [urllib2](https://docs.python.org/2/library/urllib2.html) can be used to perform a HEAD request. This is a little nicer than using httplib since urllib2 parses the URL for you instead of requiring you to split the URL into host name and path.
```
>>> import urllib2
>>> class HeadRequest(urllib2.Request):
... def g... |
How do you send a HEAD HTTP request in Python 2? | 107,405 | 97 | 2008-09-20T06:38:38Z | 4,421,712 | 15 | 2010-12-12T12:45:54Z | [
"python",
"python-2.7",
"http",
"http-headers",
"content-type"
] | What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if `http://somedomain/foo/` will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download ... | Just:
```
import urllib2
request = urllib2.Request('http://localhost:8080')
request.get_method = lambda : 'HEAD'
response = urllib2.urlopen(request)
response.info().gettype()
```
Edit: I've just came to realize there is httplib2 :D
```
import httplib2
h = httplib2.Http()
resp = h.request("http://www.google.com", 'H... |
How do you send a HEAD HTTP request in Python 2? | 107,405 | 97 | 2008-09-20T06:38:38Z | 7,387,509 | 33 | 2011-09-12T12:02:47Z | [
"python",
"python-2.7",
"http",
"http-headers",
"content-type"
] | What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if `http://somedomain/foo/` will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download ... | I believe the [Requests](http://docs.python-requests.org/en/latest/index.html) library should be mentioned as well. |
How do you send a HEAD HTTP request in Python 2? | 107,405 | 97 | 2008-09-20T06:38:38Z | 12,997,216 | 38 | 2012-10-21T11:00:49Z | [
"python",
"python-2.7",
"http",
"http-headers",
"content-type"
] | What I'm trying to do here is get the headers of a given URL so I can determine the MIME type. I want to be able to see if `http://somedomain/foo/` will return an HTML document or a JPEG image for example. Thus, I need to figure out how to send a HEAD request so that I can read the MIME type without having to download ... | Obligatory [`Requests`](http://docs.python-requests.org/en/latest/) way:
```
import requests
resp = requests.head("http://www.google.com")
print resp.status_code, resp.text, resp.headers
``` |
XML-RPC: best way to handle 64-bit values? | 107,616 | 3 | 2008-09-20T08:27:11Z | 108,032 | 7 | 2008-09-20T12:29:16Z | [
"c++",
"python",
"64bit",
"xml-rpc"
] | So the official XML-RPC standard doesn't support 64-bit values. But in these modern times, 64-bit values are increasingly common.
How do you handle these? What XML-RPC extensions are the most common? What language bindings are there? I'm especially interested in Python and C++, but all information is appreciated. | Some libraries support 64 bits extensions, indeed, but there doesn't seem to be a standard. [xmlrpc-c](http://xmlrpc-c.sourceforge.net/), for example, has a so called i8 but it doesn't work with python (at least not by default).
I would recommend to either:
* Convert the integer to string by hand and send it as such.... |
How can I unit test responses from the webapp WSGI application in Google App Engine? | 107,675 | 10 | 2008-09-20T08:56:59Z | 114,449 | 10 | 2008-09-22T12:02:08Z | [
"python",
"unit-testing",
"google-app-engine"
] | I'd like to unit test responses from the Google App Engine webapp.WSGIApplication, for example request the url '/' and test that the responses status code is 200, using [GAEUnit](http://code.google.com/p/gaeunit). How can I do this?
I'd like to use the webapp framework and GAEUnit, which runs within the App Engine san... | I have added a [sample application](http://code.google.com/p/gaeunit/source/browse/#svn/trunk/sample_app) to the GAEUnit project which demonstrates how to write and execute a web test using GAEUnit. The sample includes a slightly modified version of the '[webtest](http://pythonpaste.org/webtest/index.html)' module ('im... |
Disable output buffering | 107,705 | 285 | 2008-09-20T09:17:20Z | 107,717 | 251 | 2008-09-20T09:24:31Z | [
"python",
"stdout",
"buffered"
] | Is output buffering enabled by default in Python's interpreter for `sys.stdout`?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
1. Use the `-u` command line switch
2. Wrap `sys.stdout` in an object that flushes after every write
3. Set `PYTHONUNBUFFERED` env var
4. `sys.stdout = ... | From [Magnus Lycka answer on a mailing list](http://mail.python.org/pipermail/tutor/2003-November/026645.html):
> You can skip buffering for a whole
> python process using "python -u"
> (or#!/usr/bin/env python -u etc) or by
> setting the environment variable
> PYTHONUNBUFFERED.
>
> You could also replace sys.stdout w... |
Disable output buffering | 107,705 | 285 | 2008-09-20T09:17:20Z | 107,720 | 24 | 2008-09-20T09:25:36Z | [
"python",
"stdout",
"buffered"
] | Is output buffering enabled by default in Python's interpreter for `sys.stdout`?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
1. Use the `-u` command line switch
2. Wrap `sys.stdout` in an object that flushes after every write
3. Set `PYTHONUNBUFFERED` env var
4. `sys.stdout = ... | Yes, it is.
You can disable it on the commandline with the "-u" switch.
Alternatively, you could call .flush() on sys.stdout on every write (or wrap it with an object that does this automatically) |
Disable output buffering | 107,705 | 285 | 2008-09-20T09:17:20Z | 181,654 | 58 | 2008-10-08T07:23:10Z | [
"python",
"stdout",
"buffered"
] | Is output buffering enabled by default in Python's interpreter for `sys.stdout`?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
1. Use the `-u` command line switch
2. Wrap `sys.stdout` in an object that flushes after every write
3. Set `PYTHONUNBUFFERED` env var
4. `sys.stdout = ... | ```
# reopen stdout file descriptor with write mode
# and 0 as the buffer size (unbuffered)
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
```
Credits: "Sebastian", somewhere on the Python mailing list. |
Disable output buffering | 107,705 | 285 | 2008-09-20T09:17:20Z | 3,678,114 | 10 | 2010-09-09T15:37:53Z | [
"python",
"stdout",
"buffered"
] | Is output buffering enabled by default in Python's interpreter for `sys.stdout`?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
1. Use the `-u` command line switch
2. Wrap `sys.stdout` in an object that flushes after every write
3. Set `PYTHONUNBUFFERED` env var
4. `sys.stdout = ... | ```
def disable_stdout_buffering():
# Appending to gc.garbage is a way to stop an object from being
# destroyed. If the old sys.stdout is ever collected, it will
# close() stdout, which is not good.
gc.garbage.append(sys.stdout)
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
# Then this will ... |
Disable output buffering | 107,705 | 285 | 2008-09-20T09:17:20Z | 14,729,823 | 31 | 2013-02-06T13:05:23Z | [
"python",
"stdout",
"buffered"
] | Is output buffering enabled by default in Python's interpreter for `sys.stdout`?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
1. Use the `-u` command line switch
2. Wrap `sys.stdout` in an object that flushes after every write
3. Set `PYTHONUNBUFFERED` env var
4. `sys.stdout = ... | I would rather put my answer in [How to flush output of Python print?](http://stackoverflow.com/questions/230751/how-to-flush-output-of-python-print) or in [Python's print function that flushes the buffer when it's called?](http://stackoverflow.com/questions/3895481/pythons-print-function-that-flushes-the-buffer-when-i... |
Union and Intersect in Django | 108,193 | 30 | 2008-09-20T13:46:52Z | 108,404 | 19 | 2008-09-20T15:01:12Z | [
"python",
"django",
"django-models",
"django-views",
"tagging"
] | ```
class Tag(models.Model):
name = models.CharField(maxlength=100)
class Blog(models.Model):
name = models.CharField(maxlength=100)
tags = models.ManyToManyField(Tag)
```
Simple models just to ask my question.
I wonder how can i query blogs using tags in two different ways.
* Blog entries that are tagged wi... | You could use Q objects for #1:
```
# Blogs who have either hockey or django tags.
from django.db.models import Q
Blog.objects.filter(
Q(tags__name__iexact='hockey') | Q(tags__name__iexact='django')
)
```
Unions and intersections, I believe, are a bit outside the scope of the Django ORM, but its possible to to th... |
Union and Intersect in Django | 108,193 | 30 | 2008-09-20T13:46:52Z | 108,500 | 15 | 2008-09-20T15:33:55Z | [
"python",
"django",
"django-models",
"django-views",
"tagging"
] | ```
class Tag(models.Model):
name = models.CharField(maxlength=100)
class Blog(models.Model):
name = models.CharField(maxlength=100)
tags = models.ManyToManyField(Tag)
```
Simple models just to ask my question.
I wonder how can i query blogs using tags in two different ways.
* Blog entries that are tagged wi... | I've tested these out with Django 1.0:
The "or" queries:
```
Blog.objects.filter(tags__name__in=['tag1', 'tag2']).distinct()
```
or you could use the Q class:
```
Blog.objects.filter(Q(tags__name='tag1') | Q(tags__name='tag2')).distinct()
```
The "and" query:
```
Blog.objects.filter(tags__name='tag1').filter(tags... |
Union and Intersect in Django | 108,193 | 30 | 2008-09-20T13:46:52Z | 110,437 | 9 | 2008-09-21T07:03:07Z | [
"python",
"django",
"django-models",
"django-views",
"tagging"
] | ```
class Tag(models.Model):
name = models.CharField(maxlength=100)
class Blog(models.Model):
name = models.CharField(maxlength=100)
tags = models.ManyToManyField(Tag)
```
Simple models just to ask my question.
I wonder how can i query blogs using tags in two different ways.
* Blog entries that are tagged wi... | Please don't reinvent the wheel and use [django-tagging application](http://code.google.com/p/django-tagging/) which was made exactly for your use case. It can do all queries you describe, and much more.
If you need to add custom fields to your Tag model, you can also take a look at [my branch of django-tagging](http:... |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 108,939 | 9 | 2008-09-20T18:34:42Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | Presumably your hack was something like this:
```
# Deleting all messages older than "earliest_date"
q = db.GqlQuery("SELECT * FROM Message WHERE create_date < :1", earliest_date)
results = q.fetch(1000)
while results:
db.delete(results)
results = q.fetch(1000, len(results))
```
As you say, if there's suffic... |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 291,819 | 9 | 2008-11-14T23:58:35Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | Try using [App Engine Console](http://con.appspot.com/console/help/integration) then you dont even have to deploy any special code |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 323,041 | 7 | 2008-11-27T06:00:44Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | I've tried db.delete(results) and App Engine Console, and none of them seems to be working for me. Manually removing entries from Data Viewer (increased limit up to 200) didn't work either since I have uploaded more than 10000 entries. I ended writing this script
```
from google.appengine.ext import db
from google.app... |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 1,023,729 | 27 | 2009-06-21T11:41:24Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | I am currently deleting the entities by their key, and it seems to be faster.
```
from google.appengine.ext import db
class bulkdelete(webapp.RequestHandler):
def get(self):
self.response.headers['Content-Type'] = 'text/plain'
try:
while True:
q = db.GqlQuery("SELECT __... |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 1,882,697 | 10 | 2009-12-10T17:41:07Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | If I were a paranoid person, I would say Google App Engine (GAE) has not made it easy for us to remove data if we want to. I am going to skip discussion on index sizes and how they translate a 6 GB of data to 35 GB of storage (being billed for). That's another story, but they do have ways to work around that - limit nu... |
Delete all data for a kind in Google App Engine | 108,822 | 40 | 2008-09-20T17:34:24Z | 7,464,545 | 20 | 2011-09-18T21:17:52Z | [
"python",
"google-app-engine"
] | I would like to wipe out all data for a specific kind in Google App Engine. What is the
best way to do this?
I wrote a delete script (hack), but since there is so much data is
timeout's out after a few hundred records. | You can now use the Datastore Admin for that: <https://developers.google.com/appengine/docs/adminconsole/datastoreadmin#Deleting_Entities_in_Bulk> |
Python Music Library? | 108,848 | 36 | 2008-09-20T17:42:53Z | 108,936 | 7 | 2008-09-20T18:33:16Z | [
"python",
"audio",
"music"
] | I'm looking at writing a little drum machine in Python for fun. I've googled some and found the python pages on [music](http://wiki.python.org/moin/PythonInMusic) and [basic audio](http://wiki.python.org/moin/Audio/) as well as a StackOverflow question on [generating audio files](http://stackoverflow.com/questions/4538... | I had to do this years ago. I used pymedia. I am not sure if it is still around any way here is some test code I wrote when I was playing with it. It is about 3 years old though.
**Edit:** The sample code plays an MP3 file
```
import pymedia
import time
demuxer = pymedia.muxer.Demuxer('mp3') #this thing decodes the ... |
Python Music Library? | 108,848 | 36 | 2008-09-20T17:42:53Z | 109,147 | 13 | 2008-09-20T19:51:39Z | [
"python",
"audio",
"music"
] | I'm looking at writing a little drum machine in Python for fun. I've googled some and found the python pages on [music](http://wiki.python.org/moin/PythonInMusic) and [basic audio](http://wiki.python.org/moin/Audio/) as well as a StackOverflow question on [generating audio files](http://stackoverflow.com/questions/4538... | Take a close look at [cSounds](http://www.csounds.com/). There are Python bindings allow you to do pretty flexible digital synthesis. There are some pretty complete packages available, too.
See <http://www.csounds.com/node/188> for a package.
See <http://www.csounds.com/journal/issue6/pythonOpcodes.html> for informat... |
Is there something like 'autotest' for Python unittests? | 108,892 | 39 | 2008-09-20T18:07:40Z | 482,668 | 16 | 2009-01-27T08:42:41Z | [
"python",
"testing"
] | Basically, growl notifications (or other callbacks) when tests break or pass. **Does anything like this exist?**
If not, it should be pretty easy to write.. Easiest way would be to..
1. run `python-autotest myfile1.py myfile2.py etc.py`
2. Check if files-to-be-monitored have been modified (possibly just if they've be... | [autonose](http://github.com/gfxmonk/autonose/tree/master) created by [gfxmonk](http://gfxmonk.net/):
> Autonose is an autotest-like tool for python, using the excellent nosetest library.
>
> autotest tracks filesystem changes and automatically re-run any changed tests or dependencies whenever a file is added, removed... |
Is there something like 'autotest' for Python unittests? | 108,892 | 39 | 2008-09-20T18:07:40Z | 9,461,979 | 24 | 2012-02-27T08:28:14Z | [
"python",
"testing"
] | Basically, growl notifications (or other callbacks) when tests break or pass. **Does anything like this exist?**
If not, it should be pretty easy to write.. Easiest way would be to..
1. run `python-autotest myfile1.py myfile2.py etc.py`
2. Check if files-to-be-monitored have been modified (possibly just if they've be... | I found [autonose](https://github.com/gfxmonk/autonose) to be pretty unreliable but [sniffer](http://pypi.python.org/pypi/sniffer/0.2.3) seems to work very well.
```
$ pip install sniffer
$ cd myproject
```
Then instead of running "nosetests", you run:
```
$ sniffer
```
Or instead of `nosetests --verbose --with-doc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.