title
stringlengths
10
172
question_id
int64
469
40.1M
question_body
stringlengths
22
48.2k
question_score
int64
-44
5.52k
question_date
stringlengths
20
20
answer_id
int64
497
40.1M
answer_body
stringlengths
18
33.9k
answer_score
int64
-38
8.38k
answer_date
stringlengths
20
20
tags
list
I want a program that writes every possible combination to a different line of a text file
241,533
<p>I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file.</p> <p>Is there a simple way I can write a python program ...
4
2008-10-27T22:03:06Z
241,577
<p>A basic function to produce all the permutations of a list is given below. In this approach, permutations are created lazily by using generators.</p> <pre><code>def perms(seq): if seq == []: yield [] else: res = [] for index,item in enumerate(seq): rest = seq[:index] + se...
2
2008-10-27T22:21:14Z
[ "python", "recursion" ]
I want a program that writes every possible combination to a different line of a text file
241,533
<p>I want to write a program that would print every combination of a set of variables to a text file, creating a word list. Each answer should be written on a separate line and write all of the results for 1 digit, 2 digits, and 3 digits to a single text file.</p> <p>Is there a simple way I can write a python program ...
4
2008-10-27T22:03:06Z
242,141
<p>A naïve solution which solves the problem and is general enough for any application you might have is this:</p> <pre><code>def combinations(words, length): if length == 0: return [] result = [[word] for word in words] while length &gt; 1: new_result = [] for combo in result: ...
3
2008-10-28T03:22:09Z
[ "python", "recursion" ]
SUDS - programmatic access to methods and types
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
18
2008-10-28T00:52:41Z
1,842,812
<p>According to <code>suds</code> <a href="https://fedorahosted.org/suds/wiki/Documentation#BASICUSAGE">documentation</a>, you can inspect <code>service</code> object with <code>__str()__</code>. So the following gets a list of methods and complex types:</p> <pre><code>from suds.client import Client; url = 'http://ww...
16
2009-12-03T20:46:55Z
[ "python", "suds" ]
SUDS - programmatic access to methods and types
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
18
2008-10-28T00:52:41Z
1,858,144
<p>Okay, so SUDS does quite a bit of magic.</p> <p>A <code>suds.client.Client</code>, is built from a WSDL file:</p> <pre><code>client = suds.client.Client("http://mssoapinterop.org/asmx/simple.asmx?WSDL") </code></pre> <p>It downloads the WSDL and creates a definition in <code>client.wsdl</code>. When you call a me...
22
2009-12-07T06:12:25Z
[ "python", "suds" ]
SUDS - programmatic access to methods and types
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
18
2008-10-28T00:52:41Z
16,616,472
<p>Here's a quick script I wrote based on the above information to list the input methods suds reports as available on a WSDL. Pass in the WSDL URL. Works for the project I'm currently on, I can't guarantee it for yours.</p> <pre><code>import suds def list_all(url): client = suds.client.Client(url) for serv...
7
2013-05-17T19:25:56Z
[ "python", "suds" ]
SUDS - programmatic access to methods and types
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
18
2008-10-28T00:52:41Z
17,830,415
<p>You can access suds's ServiceDefinition object. Here's a quick sample:</p> <pre><code>from suds.client import Client c = Client('http://some/wsdl/link') types = c.sd[0].types </code></pre> <p>Now, if you want to know the prefixed name of a type, it's also quite easy:</p> <pre><code>c.sd[0].xlate(c.sd[0].types[0]...
3
2013-07-24T09:43:44Z
[ "python", "suds" ]
SUDS - programmatic access to methods and types
241,892
<p>I'm investigating SUDS as a SOAP client for python. I want to inspect the methods available from a specified service, and the types required by a specified method.</p> <p>The aim is to generate a user interface, allowing users to select a method, then fill in values in a dynamically generated form.</p> <p>I can g...
18
2008-10-28T00:52:41Z
34,442,878
<p>Once you created WSDL method object you can get information about it from it's <code>__metadata__</code>, including list of it's arguments' names.</p> <p>Given the argument's name, you can access it's actual instance in the method created. That instance also contains it's information in <code>__metadata__</code>, t...
0
2015-12-23T20:01:30Z
[ "python", "suds" ]
Is there any way to get a REPL in pydev?
241,995
<p>I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?</p>
9
2008-10-28T01:46:37Z
242,774
<p>I don't use <em>pydev</em>, but to drop to python's interactive REPL from code:</p> <pre><code>import code code.interact(local=locals()) </code></pre> <p>To drop to python's debugger from code:</p> <pre><code>import pdb pdb.set_trace() </code></pre> <p>Finally, to run a interactive REPL after running some code, ...
3
2008-10-28T10:21:22Z
[ "python", "ide", "pydev", "read-eval-print-loop" ]
Is there any way to get a REPL in pydev?
241,995
<p>I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?</p>
9
2008-10-28T01:46:37Z
516,482
<p>There is a dedicated Pydev Console available by clicking on the "New console" dropdown in the console view.</p> <p>See <a href="http://pydev.sourceforge.net/console.html">http://pydev.sourceforge.net/console.html</a></p>
5
2009-02-05T15:52:58Z
[ "python", "ide", "pydev", "read-eval-print-loop" ]
Is there any way to get a REPL in pydev?
241,995
<p>I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?</p>
9
2008-10-28T01:46:37Z
8,726,587
<p>As Dag Høidahl said, the PyDev Console is actually the best option (at least on Eclipse Indigo), no need to hack around. </p> <p>Just go to Open Console: <img src="http://i.stack.imgur.com/nXYND.png" alt="Open Console"></p> <p>Then select PyDev Console:</p> <p><img src="http://i.stack.imgur.com/nx9M1.png" alt="P...
2
2012-01-04T12:05:17Z
[ "python", "ide", "pydev", "read-eval-print-loop" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
242,063
<p>What OpenGL library are you using? What windowing library? What version of Python?</p> <p>Most likely cause I can think of is that your windowing library (SDL or whatever you're using) isn't initializing OpenGL before you start calling into it.</p>
1
2008-10-28T02:34:02Z
[ "python", "opengl", "fedora" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
242,371
<p>We have neither ideas about random segmentation faults. There is not enough information. What python libraries are you using for opengl? How do you use them? Can you show us your code? It's probably something trivial but my god -skill ends up to telling me just and only that.</p> <p>Raytracer in python? I'd prefer ...
0
2008-10-28T06:12:11Z
[ "python", "opengl", "fedora" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
246,894
<p>You may also want to consider using <a href="http://www.pyglet.org/">Pyglet</a> instead of PyOpenGL. It's a ctypes-wrapper around the native OpenGL libs on the local platform, along with windowing support (should handle most of the stuff you want to use GLUT for.) The <a href="http://groups.google.com/group/pyglet-u...
16
2008-10-29T13:58:22Z
[ "python", "opengl", "fedora" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
246,922
<p>Perhaps you are calling an OpenGL function that requires an active OpenGL context, without having one? That shouldn't necessarily crash, but I guess it might. How to set up such a context depends on the platform, and it's been a while since I used GL from Python (and when I did, I also used GTK+ which complicates ma...
0
2008-10-29T14:06:59Z
[ "python", "opengl", "fedora" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
1,778,664
<p>Well, I don't know if these are the libs the original poster are using but I saw identical issues in a pet project I'm working on (Graphics Engine using C++ and Python) using PyOpenGL.</p> <p>PyOpenGL didn't correctly pick up the rendering context if it was created after the python script had been loaded (I was loa...
2
2009-11-22T13:16:15Z
[ "python", "opengl", "fedora" ]
OpenGl with Python
242,059
<p>I am currently in a course that is using OpenGL and I have been using C for all the programs so far. I have Python installed on Fedora as well as OpenGL, however the minute I call an OpenGL command in my Python code, I get a <strong>segmentation fault</strong>. I have no idea why this is.</p> <p>Just to avoid the "...
15
2008-10-28T02:29:24Z
2,284,461
<p>Scripts never cause segmentation faults. But first see if your kernel and kmod video driver working property ... Extension modules can cause "segmentation fault".</p>
0
2010-02-17T21:14:47Z
[ "python", "opengl", "fedora" ]
Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start?
242,065
<p>I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm finding that various aspects are broken. For instance, 2.6 IDLE won't launch, and when I try to...
2
2008-10-28T02:34:19Z
242,159
<p>I had this problem so much when I first got my Mac. The best solution I found was to delete everything I'd installed and just go with the <a href="http://pythonmac.org" rel="nofollow">pythonmac.org</a> version of Python (2.6). I then installed setuptools from the same site, and then used easy_install to install ever...
4
2008-10-28T03:28:57Z
[ "python", "python-2.6", "python-install" ]
Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start?
242,065
<p>I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm finding that various aspects are broken. For instance, 2.6 IDLE won't launch, and when I try to...
2
2008-10-28T02:34:19Z
248,884
<p>Macports should be easy to get rid of; just delete /opt/local/. I think that Fink does something similar.</p> <p>You can do <code>which python</code> to see what python is the default one. The system python should be in /System/Library/Frameworks/Python.framework/Versions/2.5/bin/python</p> <p>The MacPython you ma...
1
2008-10-30T00:08:53Z
[ "python", "python-2.6", "python-install" ]
Python + Leopard + Fink + Mac Ports + Python.org + Idiot = broken Python - fresh start?
242,065
<p>I have been enjoying learning the basics of python, but before I started reading things I tried to install various python versions and modules clumsily. Now that I have some ideas of what I want to do and how to do it I'm finding that various aspects are broken. For instance, 2.6 IDLE won't launch, and when I try to...
2
2008-10-28T02:34:19Z
286,372
<p>The easiest way to start afresh with Mac Ports or Fink is to simply remove the folder <code>/sw/</code> (for fink) or <code>/opt/</code> for MacPorts.</p> <p>To completely remove them, you will have to remove a line in your <code>~/.profile</code> file:</p> <p>For fink:</p> <pre><code>test -r /sw/bin/init.sh &amp...
1
2008-11-13T06:24:42Z
[ "python", "python-2.6", "python-install" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
242,327
<p>I use a technique very similar to this in order to show the current subversion revision number in my shell:</p> <pre><code>svnRev=$(echo "$(svn info)" | grep "^Revision" | awk -F": " '{print $2};') echo $svnRev </code></pre> <p>It works very well for me.</p> <p>Why do you want the python files to change every tim...
1
2008-10-28T05:38:35Z
[ "python", "svn" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
242,508
<p>Python has direct bindings to libsvn, so you don't need to invoke the command line client at all. See <a href="http://jtauber.com/python_subversion_binding/" rel="nofollow">this blog post</a> for more details.</p> <p>EDIT: You can basically do something like this:</p> <pre><code>from svn import fs, repos, core rep...
2
2008-10-28T07:52:08Z
[ "python", "svn" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
242,515
<p>There is a command called <code>svnversion</code> which comes with subversion and is meant to solve exactly that kind of problem.</p>
3
2008-10-28T07:57:08Z
[ "python", "svn" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
242,634
<p>If you want to have a variable in one source file that can be set to the current working copy revision, and does not replay on subversion and a working copy being actually available at the time you run your program, then <a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-subwcrev.html" rel="nofollow">S...
1
2008-10-28T09:21:22Z
[ "python", "svn" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
243,088
<p>Stolen directly from django:</p> <pre><code>def get_svn_revision(path=None): rev = None if path is None: path = MODULE.__path__[0] entries_path = '%s/.svn/entries' % path if os.path.exists(entries_path): entries = open(entries_path, 'r').read() # Versions &gt;= 7 of the entr...
3
2008-10-28T12:28:20Z
[ "python", "svn" ]
How does one add a svn repository build number to Python code?
242,295
<blockquote> <p><strong>EDIT</strong>: This question duplicates <a href="http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173">http://stackoverflow.com/questions/110175/how-to-access-the-current-subversion-build-number#111173</a> (Thanks for the heads up, Charles!)</p> </...
3
2008-10-28T05:10:33Z
245,505
<p>Based on CesarB's response and the link Charles provided, I've done the following:</p> <pre><code>try: from subprocess import Popen, PIPE _p = Popen(["svnversion", "."], stdout=PIPE) REVISION= _p.communicate()[0] _p = None # otherwise we get a wild exception when Django auto-reloads except Exception, e: p...
0
2008-10-29T01:32:14Z
[ "python", "svn" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
242,506
<p>This isn't the debugger, but probably just as useful(?)</p> <p>I know I heard Guido mention this in a speech somewhere.</p> <p>I just checked python -?, and if you use the -i command you can interact where your script stopped.</p> <p>So given this script:</p> <pre><code>testlist = [1,2,3,4,5, 0] prev_i = None f...
26
2008-10-28T07:51:45Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
242,514
<p>You can use <a href="http://docs.python.org/library/traceback.html#traceback.print_exc">traceback.print_exc</a> to print the exceptions traceback. Then use <a href="http://docs.python.org/library/sys#sys.exc_info">sys.exc_info</a> to extract the traceback and finally call <a href="http://docs.python.org/library/pdb#...
64
2008-10-28T07:56:24Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
242,531
<p>Use the following module:</p> <pre><code>import sys def info(type, value, tb): if hasattr(sys, 'ps1') or not sys.stderr.isatty(): # we are in interactive mode or we don't have a tty-like # device, so we call the default hook sys.__excepthook__(type, value, tb) else: import traceback...
43
2008-10-28T08:14:56Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
2,438,834
<pre><code>python -m pdb myscript.py </code></pre> <p>You'll need to enter 'c' (for Continue) when execution begins, but then it will run to the error point and give you control there.</p>
170
2010-03-13T15:20:52Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
4,873,570
<p>You can put this line in your code:</p> <pre><code>import pdb ; pdb.set_trace() </code></pre> <p>More info: <a href="http://www.technomancy.org/python/debugger-start-line/" rel="nofollow">Start the python debugger at any line</a></p>
4
2011-02-02T10:57:45Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
13,003,378
<p><strong>Ipython</strong> has a command for toggling this behavior: <strong>%pdb</strong>. It does exactly what you described, maybe even a bit more (giving you more informative backtraces with syntax highlighting and code completion). It's definitely worth a try!</p>
16
2012-10-21T23:49:51Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
23,113,690
<p>Put a breakpoint inside the constructor of topmost exception class in the hierarchy, and most of the times you will see where the error was raised.</p> <p>Putting a breakpoint means whatever you want it to mean : you can use an IDE, or <code>pdb.set_trace</code>, or whatever</p>
0
2014-04-16T15:23:22Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
34,733,850
<p>To have it run without having to type c at the beginning use:</p> <pre><code>python -m pdb -c c &lt;script name&gt; </code></pre> <p>Pdb has its own command line arguments: -c c will execute c(ontinue) command at start of execution and the program will run uninterrupted until the error.</p>
2
2016-01-12T00:54:16Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
35,039,165
<p>IPython makes this simple on the command line:</p> <pre><code>python myscript.py arg1 arg2 </code></pre> <p>can be rewritten to</p> <pre><code>ipython --pdb myscript.py -- arg1 arg2 </code></pre> <p>Or, similarly, if calling a module:</p> <pre><code>python -m mymodule arg1 arg2 </code></pre> <p>can be rewritte...
5
2016-01-27T13:49:16Z
[ "python", "debugging" ]
Starting python debugger automatically on error
242,485
<p>This is a question I have wondered about for quite some time, yet I have never found a suitable solution. If I run a script and I come across, let's say an IndexError, python prints the line, location and quick description of the error and exits. Is it possible to automatically start pdb when an error is encountered...
106
2008-10-28T07:37:15Z
35,489,235
<p>If you are running a module:</p> <pre><code>python -m mymodule </code></pre> <p>And now you want to enter <code>pdb</code> when an exception occurs, do this:</p> <pre><code>PYTHONPATH="." python -m pdb -c c mymodule/__main__.py </code></pre> <p>(or <em>extend</em> your <code>PYTHONPATH</code>). The <code>PYTHONP...
0
2016-02-18T18:11:21Z
[ "python", "debugging" ]
How to set the PYTHONPATH in Emacs?
243,060
<p>Emacs does not recognize my correct python path. I think it is a general problem with emacs not recognizing my environment variables. I have GNU Emacs 22.1.1 (i386-apple-darwin8.9.1, Carbon Version 1.6.0) of 2007-06-17 installed.</p> <p>I have set the PYTHONPATH in my ~/.bashrc. Maybe I should set it somewhere else...
14
2008-10-28T12:17:35Z
243,239
<p><code>.bashrc</code> only gets read when a shell starts; it won't affect Carbon Emacs. Instead, use <code>setenv</code> in your <code>.emacs</code>:</p> <pre><code>(setenv "PYTHONPATH" "PATH_STRING_HERE") </code></pre> <p>You can set <code>PYTHONPATH</code> for the entire Mac OS session, by adding it to <code>~/.M...
21
2008-10-28T13:17:01Z
[ "python", "emacs", "environment-variables" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,393
<p>img's use GET. You'll have to come up with another mechanism. How about calling the same functionality in image.py and saving the file as a temp file which you ref in the img tag? Or how about saving the value of text in a db row during the rendering of this img tag and using the row_id as what you pass into the ...
0
2008-10-28T13:52:14Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,397
<p>Store the text somewhere (e.g. a database) and then pass through the primary key.</p>
5
2008-10-28T13:52:34Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,515
<p>This will get you an Image as the result of a POST -- you may not like it</p> <ol> <li>Put an iFrame where you want the image and size it and remove scrollbars</li> <li>Set the src to a form with hidden inputs set to your post parameters and the action set to the URL that will generate the image</li> <li><p>submit ...
1
2008-10-28T14:22:51Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,521
<p>Putting together what has already been said, how about creating two pages. First page sends a POST request when the form is submitted (lets say to create_img.py) with a text=xxxxxxx... parameter. Then create_img.py takes the text parameter and creates an image with it and inserts it (or a filesystem reference) into ...
1
2008-10-28T14:24:46Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,538
<p>You may be able to mitigate the problem by compressing the text in the get parameter.</p>
0
2008-10-28T14:28:54Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,603
<p>From the link below it looks like you'll be fine for a while ;)</p> <p><a href="http://www.boutell.com/newfaq/misc/urllength.html" rel="nofollow">http://www.boutell.com/newfaq/misc/urllength.html</a></p>
0
2008-10-28T14:48:08Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
243,860
<p>If you're using django, maybe you can do this via a template tag instead?</p> <p>Something like:</p> <pre><code>&lt;img src="{% create_image "This is the text that will be displayed" %}"&gt; </code></pre> <p>The create_image function would create the image with a dummy/random/generated filename, and return the pa...
0
2008-10-28T16:05:39Z
[ "python", "html", "django", "cgi", "image" ]
Including a dynamic image in a web page using POST?
243,375
<p>I have written a CGI script that creates an image dynamically using GET data. To include this image in my webpage, I am using the following code:</p> <pre><code>&lt;img src="image.py?text=xxxxxxxxxxxxxx"&gt; </code></pre> <p>The problem is that I expect in the future the "text" field will get very long and the URL...
2
2008-10-28T13:46:35Z
1,051,870
<p>OK, I'm a bit late to the party, but you could use a mix of MHTML (for IE7 and below) and the data URI scheme (for all other modern browsers). It does require a bit of work on both client and server but you can ultimately end up with</p> <pre><code>newimg.src = 'blah'; </code></pre> <p>The write-up on how to do th...
0
2009-06-27T01:05:49Z
[ "python", "html", "django", "cgi", "image" ]
Unicode block of a character in python
243,831
<p>Is there a way to get the Unicode Block of a character in python? The <a href="http://www.python.org/doc/2.5.2/lib/module-unicodedata.html" rel="nofollow">unicodedata</a> module doesn't seem to have what I need, and I couldn't find an external library for it.</p> <p>Basically, I need the same functionality as <a hr...
5
2008-10-28T15:56:18Z
245,072
<p>I couldn't find one either. Strange!</p> <p>Luckily, the number of Unicode blocks is quite manageably small.</p> <p>This implementation accepts a one-character Unicode string, just like the functions in <code>unicodedata</code>. If your inputs are mostly ASCII, this linear search might even be faster than binary...
10
2008-10-28T22:13:30Z
[ "python", "unicode", "character-properties" ]
Unicode block of a character in python
243,831
<p>Is there a way to get the Unicode Block of a character in python? The <a href="http://www.python.org/doc/2.5.2/lib/module-unicodedata.html" rel="nofollow">unicodedata</a> module doesn't seem to have what I need, and I couldn't find an external library for it.</p> <p>Basically, I need the same functionality as <a hr...
5
2008-10-28T15:56:18Z
1,878,387
<p>unicodedata.name(chr)</p>
0
2009-12-10T03:00:47Z
[ "python", "unicode", "character-properties" ]
How to copy all properties of an object to another object, in Python?
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python? I mean, something like Apache Commons' PropertyUtilsBean.copyProperties()</p> <p>Thanks!</p>
21
2008-10-28T15:58:11Z
244,116
<p>If your class does not modify <code>__getitem__</code> or <code>__setitem__</code> for special attribute access all your attributes are stored in <code>__dict__</code> so you can do:</p> <pre><code> nobj.__dict__ = oobj.__dict__.copy() # just a shallow copy </code></pre> <p>If you use python properties you shou...
20
2008-10-28T17:16:27Z
[ "python" ]
How to copy all properties of an object to another object, in Python?
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python? I mean, something like Apache Commons' PropertyUtilsBean.copyProperties()</p> <p>Thanks!</p>
21
2008-10-28T15:58:11Z
244,654
<p>Try <code>destination.__dict__.update(source.__dict__)</code>.</p>
27
2008-10-28T20:06:09Z
[ "python" ]
How to copy all properties of an object to another object, in Python?
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python? I mean, something like Apache Commons' PropertyUtilsBean.copyProperties()</p> <p>Thanks!</p>
21
2008-10-28T15:58:11Z
244,789
<p>I know you down-modded copy, but I disagree. It's more clear to make another copy than to modify the existing in-place with <strong>dict</strong> manipulation, as others suggested (if you lose existing copy by reassigning the variable, it will get garbage-collected immediately). Python is not meant to be fast, it's ...
1
2008-10-28T20:41:35Z
[ "python" ]
How to copy all properties of an object to another object, in Python?
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python? I mean, something like Apache Commons' PropertyUtilsBean.copyProperties()</p> <p>Thanks!</p>
21
2008-10-28T15:58:11Z
248,608
<p>At the risk of being modded down, is there <strike>a decent</strike> any use-case for this? </p> <p>Unless we know exactly what it's for, we can't sensibly call it as "broken" as it seems.</p> <p>Perhaps try this:</p> <pre><code>firstobject.an_attribute = secondobject.an_attribute firstobject.another_attribute = ...
-1
2008-10-29T22:07:04Z
[ "python" ]
How to copy all properties of an object to another object, in Python?
243,836
<p>Is there a library method to copy all the properties between two (already present) instances of the same class, in Python? I mean, something like Apache Commons' PropertyUtilsBean.copyProperties()</p> <p>Thanks!</p>
21
2008-10-28T15:58:11Z
252,393
<p>If you have to do this, I guess the nicest way is to have a class attribute something like :</p> <pre><code>Class Copyable(object): copyable_attributes = ('an_attribute', 'another_attribute') </code></pre> <p>Then iterate them explicitly and use <code>setattr(new, attr, getattr(old, attr))</code>. I still beli...
1
2008-10-31T01:48:56Z
[ "python" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
244,078
<p>Here you go:</p> <pre><code>let rec range i j = if i &gt; j then [] else i :: (range (i+1) j) </code></pre> <p>Note that this is not tail-recursive. Modern Python versions even have a lazy range.</p>
9
2008-10-28T17:07:22Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
244,104
<p>There is no idiom that I know of, but here is a fairly natural definition using an infix operator:</p> <pre><code># let (--) i j = let rec aux n acc = if n &lt; i then acc else aux (n-1) (n :: acc) in aux j [] ;; val ( -- ) : int -&gt; int -&gt; int list = &lt;fun&gt; # 1--2;; - : int list = [1...
19
2008-10-28T17:13:42Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
244,843
<p>BTW, in Haskell you'd rather use</p> <pre><code>enumFromTo 1 n [1 .. n] </code></pre> <p>These are just unnecessary.</p> <pre><code>take n [1 ..] take n $ iterate (+1) 1 </code></pre>
0
2008-10-28T20:56:13Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
2,926,149
<p>With <a href="http://batteries.forge.ocamlcore.org">Batteries Included</a>, you can write</p> <pre><code>let nums = List.of_enum (1--10);; </code></pre> <p>The <code>--</code> operator generates an enumeration from the first value to the second. The <code>--^</code> operator is similar, but enumerates a half-open...
10
2010-05-28T01:33:00Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
27,674,212
<p>If you use <code>open Batteries</code> (which is a community version of the standard library), you can do <code>range(1,n+1)</code> by <code>List.range 1 `To n</code> (notice the backquote before <code>To</code>).</p> <p>A more general way (also need batteries) is to use <code>List.init n f</code> which returns a l...
2
2014-12-28T06:33:31Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
33,000,776
<p>OCaml has special syntax for pattern matching on ranges:</p> <pre><code>let () = let my_char = 'a' in let is_lower_case = match my_char with | 'a'..'z' -&gt; true (* Two dots define a range pattern *) | _ -&gt; false in printf "result: %b" is_lower_case </code></pre> <p>To create a range, you can use <...
1
2015-10-07T19:25:48Z
[ "python", "ocaml" ]
What is the OCaml idiom equivalent to Python's range function?
243,864
<p>I want to create a list of integers from 1 to n. I can do this in Python using range(1, n+1), and in Haskell using: take n (iterate (1+) 1). </p> <p>What is the right OCaml idiom for this?</p>
16
2008-10-28T16:06:33Z
36,098,304
<p>A little late to the game here but here's my implementation:</p> <pre><code>let rec range ?(start=0) len = if start &gt;= len then [] else start :: (range len ~start:(start+1)) </code></pre> <p>You can then use it very much like the python function:</p> <pre><code>range 10 (* equals: [0; 1; 2; 3...
0
2016-03-19T05:41:34Z
[ "python", "ocaml" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
243,892
<p>I'd do something like this. This will be most time and space efficient, since you won't have the overhead of zipping objects together. This will also work if both <code>a</code> and <code>b</code> are infinite.</p> <pre><code>def imerge(a, b): i1 = iter(a) i2 = iter(b) while True: try: ...
10
2008-10-28T16:12:19Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
243,902
<p>A generator will solve your problem nicely.</p> <pre><code>def imerge(a, b): for i, j in itertools.izip(a,b): yield i yield j </code></pre>
32
2008-10-28T16:14:02Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
243,909
<p>You can use <code>zip</code> as well as <code>itertools.chain</code>. This will <b>only work</b> if the first list is <b>finite</b>:</p> <pre><code>merge=itertools.chain(*[iter(i) for i in zip(['foo', 'bar'], itertools.count(1))]) </code></pre>
6
2008-10-28T16:15:15Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
244,049
<p>You can do something that is almost exaclty what @Pramod first suggested.</p> <pre><code>def izipmerge(a, b): for i, j in itertools.izip(a,b): yield i yield j </code></pre> <p>The advantage of this approach is that you won't run out of memory if both a and b are infinite.</p>
13
2008-10-28T16:59:35Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
244,957
<p>Why is itertools needed?</p> <pre><code>def imerge(a,b): for i,j in zip(a,b): yield i yield j </code></pre> <p>In this case at least one of a or b must be of finite length, cause zip will return a list, not an iterator. If you need an iterator as output then you can go for the Claudiu solution.</p>
0
2008-10-28T21:34:43Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
245,042
<p>I'm not sure what your application is, but you might find the enumerate() function more useful.</p> <pre><code>&gt;&gt;&gt; items = ['foo', 'bar', 'baz'] &gt;&gt;&gt; for i, item in enumerate(items): ... print item ... print i ... foo 0 bar 1 baz 2 </code></pre>
3
2008-10-28T22:03:08Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
345,415
<p>I also agree that itertools is not needed.</p> <p>But why stop at 2?</p> <pre><code> def tmerge(*iterators): for values in zip(*iterators): for value in values: yield value </code></pre> <p>handles any number of iterators from 0 on upwards.</p> <p>UPDATE: DOH! A commenter pointed out that th...
8
2008-12-05T22:39:29Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
345,433
<p>Using itertools.izip(), instead of zip() as in some of the other answers, will improve performance:</p> <p>As "pydoc itertools.izip" shows: "Works like the zip() function but consumes less memory by returning an iterator instead of a list."</p> <p>Itertools.izip will also work properly even if one of the iterator...
0
2008-12-05T22:46:37Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
345,576
<p>Use izip and chain together:</p> <pre><code>&gt;&gt;&gt; list(itertools.chain.from_iterable(itertools.izip(items, c))) # 2.6 only ['foo', 1, 'bar', 2] &gt;&gt;&gt; list(itertools.chain(*itertools.izip(items, c))) ['foo', 1, 'bar', 2] </code></pre>
1
2008-12-06T00:08:15Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
394,427
<p>A concise method is to use a generator expression with itertools.cycle(). It avoids creating a long chain() of tuples.</p> <pre><code>generator = (it.next() for it in itertools.cycle([i1, i2])) </code></pre>
0
2008-12-26T23:04:50Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
5,399,982
<p>I prefer this other way which is much more concise:</p> <pre><code>iter = reduce(lambda x,y: itertools.chain(x,y), iters) </code></pre>
3
2011-03-23T01:48:00Z
[ "python", "merge", "iterator" ]
How do I merge two python iterators?
243,865
<p>I have two iterators, a <code>list</code> and an <code>itertools.count</code> object (i.e. an infinite value generator). I would like to merge these two into a resulting iterator that will alternate yield values between the two:</p> <pre><code>&gt;&gt;&gt; import itertools &gt;&gt;&gt; c = itertools.count(1) &gt;&g...
16
2008-10-28T16:07:12Z
5,487,453
<p>One of the less well known features of Python is that you can have more for clauses in a generator expression. Very useful for flattening nested lists, like those you get from zip()/izip().</p> <pre><code>def imerge(*iterators): return (value for row in itertools.izip(*iterators) for value in row) </code></pre>...
3
2011-03-30T14:09:21Z
[ "python", "merge", "iterator" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
243,981
<p>If you just plan on doing Python dev, I'd just go with <a href="http://download.eclipse.org/eclipse/downloads/" rel="nofollow">Platform Runtime Binary</a>.</p> <p>After that, I'd follow the instructions <a href="http://pydev.org/download.html" rel="nofollow">http://pydev.org/download.html</a> and <a href="http://py...
26
2008-10-28T16:39:43Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
244,066
<p>If you are getting started, I would recommend you <a href="http://www.easyeclipse.org/site/distributions/python.html" rel="nofollow">python easyeclipse</a>.</p> <p>Pydev can give some incompatibilities when using it together with other extensions.</p>
3
2008-10-28T17:04:32Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
244,077
<p>I use J2EE Eclipse for Python and Java development. It works well. But Classic Eclipse should be enought.</p>
0
2008-10-28T17:07:04Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
245,013
<p>PyDev was acquired by <a href="http://www.aptana.com">Aptana</a>, so you might want to check that one out as well.</p>
5
2008-10-28T21:52:00Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
280,400
<p>pydev and Python2.6 doesnt work with eclipse for C++. Download the classic version and you should be good. </p>
1
2008-11-11T09:09:21Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
1,215,589
<p>A useful shortcut is to download <a href="http://www.easyeclipse.org/site/plugins/pydev.html" rel="nofollow">EasyEclipse for PyDev</a>. This is a version of Eclipse already pre-configured for pydev, and seems to be easier to install than gathering all of the Eclipse pieces yourself. Unfortunately it uses a rather ...
3
2009-08-01T01:31:35Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
1,836,492
<p>I think that the Aptana distribution of Eclipse the the easiest way to get PyDev these days...especially since it's now free for the full version. If you download the Studio from here: <a href="http://www.aptana.org/" rel="nofollow">http://www.aptana.org/</a> You can easily install PyDev from their plugin manager...
0
2009-12-02T23:02:36Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
2,017,110
<p>I'd recommend <a href="http://www.liclipse.com/" rel="nofollow">http://www.liclipse.com/</a> if you want a simple and straightforward setup (especially for web development, as it also has editors for web-related contents, such as html, css, javascript) or getting only the Platform Runtime Binary (which is the lighte...
1
2010-01-06T23:24:30Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
4,540,487
<p>Assuming Python, and nothing else - I would just get the "Runtime Binary" edition of Eclipse, and add the <a href="http://pydev.org/" rel="nofollow">PyDev</a> extension. That way Eclipse starts up lightning fast, consumes less memory and generally gets in your way less. On top of that, you can always add in whatever...
4
2010-12-27T17:25:14Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
29,951,922
<p>I prefer that you should use <strong>Luna</strong> which is a tool for Java developers creating Java EE and Web applications, surely you can add PyDev to it.</p> <p>As you are getting started with python, eclipse and pydev, you probably need step-by-step process.</p> <p>Either follow these simple steps or Watch th...
2
2015-04-29T18:39:53Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
32,294,967
<p>I would just get [ JetBrains PyCharm Community Edition 4.5.3 ]. its FREE, fully featured and most of all, its dedicated for Python development.</p> <p>there are 3 other IDE's that are great too, and they do over 30 languages each, without needing plugins and additional 18 more by adding plugins. check out --> Brack...
0
2015-08-30T09:10:57Z
[ "python", "eclipse", "package", "pydev" ]
Which Eclipse package to download for pydev?
243,962
<p>I'm getting started with python, eclipse and pydev. Which Eclipse package should I choose? Nothing on the eclipse homepage tells me what to choose and python documentation assumes I have eclipse installed. Does which package I choose matter?</p>
52
2008-10-28T16:33:20Z
37,792,530
<p>Easy Eclipse for python is good and light weight tool. But, then you dont get any of the extra features from it.</p> <p>I tried to start with Django learning, but thn this version wasn't enough for it. If you only opt fr simple python codes, its a very good tool.</p>
0
2016-06-13T14:35:25Z
[ "python", "eclipse", "package", "pydev" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
244,205
<p>I used to program in BASIC in the QBasic days. QBASIC had subroutines, functions, structures (they used to be called types), and I guess that's it. Now, this seems limited compared to all the features that Python has - OO, lambdas, metaclasses, generators, list comprehensions, just to name a few off the top of my he...
0
2008-10-28T17:58:50Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
244,207
<p>Good question...</p> <p>Basically (sic!), I have no answer. I would say just that Lua is very easy to learn, probably as easy as Basic (which was one of my first languages as well, I used dialects on lot of 8-bit computers...), but is more powerful (allowing OO or functional styles and even mixing them) and somehow...
1
2008-10-28T17:59:19Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
244,220
<p>At the risk of sounding like two old-timers on rocking chairs, let me grumpily say that "Kids today don't appreciate BASIC" and then paradoxically say "They don't know how good they've got it." </p> <p>BASICs greatest strength was <em>always</em> its comprehensibility. It was something that people could <em>get</em...
1
2008-10-28T18:02:35Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
244,304
<p>[This may come off sounding more negative than it really is. I'm not saying Basic is the root of all evil, <a href="http://en.wikiquote.org/wiki/Edsger_Dijkstra">others have said that</a>. I'm saying it's a legacy we can afford to leave behind.]</p> <p><strong>"because it was so easy to understand and so hard to ...
10
2008-10-28T18:24:02Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
244,932
<p>Well, these people seem to think that not only basic still has a place in the mobile space but also that they can make money off it:</p> <p><a href="http://www.nsbasic.com/symbian/" rel="nofollow">http://www.nsbasic.com/symbian/</a></p>
1
2008-10-28T21:27:54Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
246,417
<p>As an architecture, the main claim to fame of BASIC is that you could make BASIC interpreters very small - just a few KB. In the days of a DG Nova this was a win as you could use systems like Business BASIC to build a multiuser application on a machine with 64K of RAM (or even less).</p> <p>BASIC (VB in particular...
5
2008-10-29T11:04:48Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
275,378
<p>Why not give Jumentum a try and see how it works for you?</p> <p><a href="http://jumentum.sourceforge.net/" rel="nofollow">http://jumentum.sourceforge.net/</a></p> <p>it's an open source BASIC for micrcontrollers</p> <p>The elua project is also lua for microcontrollers</p> <p><a href="http://elua.berlios.de/" re...
2
2008-11-08T23:33:44Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
316,381
<p>BASIC persists, particularly in the STAMP implementation, because it is lower level than most other very-easy-to-learn programming languages. For most embedded BASIC implementations the BASIC instructions map directly to single or groups of machine instructions, with very little overhead. The same programs written...
2
2008-11-25T04:38:06Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
With Lua and Python embeddable, is there a place for Basic?
244,138
<p>I started off programming in Basic on the <a href="http://en.wikipedia.org/wiki/ZX81" rel="nofollow">ZX81</a>, then <a href="http://en.wikipedia.org/wiki/IBM_BASICA" rel="nofollow">BASICA</a>, <a href="http://en.wikipedia.org/wiki/GW-BASIC" rel="nofollow">GW-BASIC</a>, and <a href="http://en.wikipedia.org/wiki/QBasi...
6
2008-10-28T17:27:32Z
383,799
<p>I started out on a ZX81 too. But as <a href="http://en.wikipedia.org/wiki/C._A._R._Hoare" rel="nofollow">Tony Hoare</a> said, programming in BASIC is like trying to do long division using roman numerals.</p> <blockquote> <p>Plenty of other languages are considered dead, but basic just keeps hanging on.</p> </...
1
2008-12-20T22:03:43Z
[ "python", "scripting", "lua", "interpreter", "basic" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,455
<p>Dumb way, but one that comes immediately to my mind:</p> <pre><code>def fields_from_list(keys, values): iterator = iter(values) while True: yield dict((key, iterator.next()) for key in keys) list(fields_from_list(keys, values)) # to produce a list. </code></pre>
2
2008-10-28T19:11:35Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,461
<p><code>zip</code> nearly does what you want; unfortunately, rather than cycling the shorter list, it breaks. Perhaps there's a related function that cycles?</p> <pre><code>$ python &gt;&gt;&gt; keys = ['name', 'age'] &gt;&gt;&gt; values = ['Monty', 42, 'Matt', 28, 'Frank', 33] &gt;&gt;&gt; dict(zip(keys, values)) {'...
2
2008-10-28T19:13:29Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,471
<p>Here's my simple approach. It seems to be close to the idea that @Cheery had except that I destroy the input list.</p> <pre><code>def pack(keys, values): """This function destructively creates a list of dictionaries from the input lists.""" retval = [] while values: d = {} for x in keys: d[x] =...
1
2008-10-28T19:16:01Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,515
<p>Yet another try, perhaps dumber than the first one:</p> <pre><code>def split_seq(seq, count): i = iter(seq) while True: yield [i.next() for _ in xrange(count)] &gt;&gt;&gt; [dict(zip(keys, rec)) for rec in split_seq(values, len(keys))] [{'age': 42, 'name': 'Monty'}, {'age': 28, 'name': 'Matt'}, {...
1
2008-10-28T19:28:24Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,551
<p>Here is the zip way</p> <pre><code>def mapper(keys, values): n = len(keys) return [dict(zip(keys, values[i:i + n])) for i in range(0, len(values), n)] </code></pre>
13
2008-10-28T19:35:22Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,618
<p>In the answer by <a href="http://stackoverflow.com/questions/244438/map-two-lists-into-one-single-list-of-dictionaries#244461">Konrad Rudolph</a></p> <blockquote> <p>zip nearly does what you want; unfortunately, rather than cycling the shorter list, it breaks. Perhaps there's a related function that cycles?</p> <...
2
2008-10-28T19:55:04Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
244,664
<p>It's not pretty but here's a one-liner using a list comprehension, zip and stepping:</p> <pre><code>[dict(zip(keys, a)) for a in zip(values[::2], values[1::2])] </code></pre>
3
2008-10-28T20:09:51Z
[ "python", "dictionary", "list" ]
Map two lists into one single list of dictionaries
244,438
<p>Imagine I have these python lists:</p> <pre><code>keys = ['name', 'age'] values = ['Monty', 42, 'Matt', 28, 'Frank', 33] </code></pre> <p>Is there a direct or at least a simple way to produce the following list of dictionaries ?</p> <pre><code>[ {'name': 'Monty', 'age': 42}, {'name': 'Matt', 'age': 28}, ...
6
2008-10-28T19:06:54Z
247,862
<pre><code>[dict(zip(keys,values[n:n+len(keys)])) for n in xrange(0,len(values),len(keys)) ] </code></pre> <p>UG-LEEE. I'd hate to see code that looks like that. But it looks right.</p> <pre><code>def dictizer(keys, values): steps = xrange(0,len(values),len(keys)) bites = ( values[n:n+len(keys)] for n in step...
0
2008-10-29T18:25:12Z
[ "python", "dictionary", "list" ]
opengl set texture color with vertex color
244,720
<p>Because I need to display a <a href="http://codeflow.org/ubuntu.png" rel="nofollow">huge number of labels</a> that <a href="http://www.youtube.com/watch?v=A_ah-SE-cNY" rel="nofollow">move independently</a>, I need to render a label in <a href="http://pyglet.org" rel="nofollow">pyglet</a> to a texture (otherwise upda...
1
2008-10-28T20:25:55Z
246,962
<p>Isn't that when you use decaling, through <code><a href="http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/texenv.html" rel="nofollow">glTexEnv()</a></code>?</p>
0
2008-10-29T14:16:52Z
[ "python", "opengl", "pyglet" ]