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 |
|---|---|---|---|---|---|---|---|---|---|
User management API | 1,961,012 | <p>I am developing an application suite where users will need to connect to a server and depending on their account type they will be given some services. The server will run Linux. Can you please suggest me some user management API which I can use to develop the server program? By user management I mean user authentic... | 2 | 2009-12-25T11:22:17Z | 2,550,080 | <p><a href="http://web.mit.edu/Kerberos/" rel="nofollow">http://web.mit.edu/Kerberos/</a> Not a drop in solution, but not quite sure what you're looking for.</p>
| 0 | 2010-03-31T02:31:35Z | [
"c++",
"python",
"linux",
"user-management"
] |
User management API | 1,961,012 | <p>I am developing an application suite where users will need to connect to a server and depending on their account type they will be given some services. The server will run Linux. Can you please suggest me some user management API which I can use to develop the server program? By user management I mean user authentic... | 2 | 2009-12-25T11:22:17Z | 2,581,917 | <p><a href="http://docs.djangoproject.com/en/1.1/topics/auth/#topics-auth" rel="nofollow">Django</a> is a python framework that provides all these services. It's very modular too, so you only have to use the components that what you want/need.</p>
<p>Its default admin tools provide authentication and authorization. In... | 0 | 2010-04-06T00:16:11Z | [
"c++",
"python",
"linux",
"user-management"
] |
User management API | 1,961,012 | <p>I am developing an application suite where users will need to connect to a server and depending on their account type they will be given some services. The server will run Linux. Can you please suggest me some user management API which I can use to develop the server program? By user management I mean user authentic... | 2 | 2009-12-25T11:22:17Z | 2,581,928 | <p>You should check out <a href="http://en.wikipedia.org/wiki/Pluggable_Authentication_Modules" rel="nofollow">PAM</a>.</p>
<p>For security, you should only do this over SSL so that the user's password is not sent over the wire in cleartext.</p>
| 0 | 2010-04-06T00:21:28Z | [
"c++",
"python",
"linux",
"user-management"
] |
Where does execution resume following an exception? | 1,961,158 | <p>In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?</p>
| 3 | 2009-12-25T13:20:11Z | 1,961,165 | <p>It resumes where the exception is caught. Otherwise, what would be the point of writing the exception clause?</p>
| 1 | 2009-12-25T13:25:21Z | [
"c++",
"python",
"exception"
] |
Where does execution resume following an exception? | 1,961,158 | <p>In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?</p>
| 3 | 2009-12-25T13:20:11Z | 1,961,176 | <p>The code inside the catch block is executed and the original execution continues right after the catch block.</p>
| 7 | 2009-12-25T13:33:19Z | [
"c++",
"python",
"exception"
] |
Where does execution resume following an exception? | 1,961,158 | <p>In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?</p>
| 3 | 2009-12-25T13:20:11Z | 1,961,177 | <p>Execution continues in the catch block (where the exception was caught).<br>
This is consistent across languages that uses exceptions.</p>
<p>The important point to note (especially in C++)<br>
Between the throw and the catch point the stack is unwound in an orderly manor so that all objects created on the stack ar... | 2 | 2009-12-25T13:33:49Z | [
"c++",
"python",
"exception"
] |
Where does execution resume following an exception? | 1,961,158 | <p>In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?</p>
| 3 | 2009-12-25T13:20:11Z | 1,961,180 | <p>the execution resumes where the exception is caught, that is at the beginning of the <code>catch</code> block which specifically address the current exception type. the catch block is executed, the other catch blocks are ignored (think of multiple <code>catch</code> block as a switch statement). in some languages, a... | 3 | 2009-12-25T13:37:40Z | [
"c++",
"python",
"exception"
] |
Where does execution resume following an exception? | 1,961,158 | <p>In general, where does program execution resume after an exception has been thrown and caught? Does it resume following the line of code where the exception was thrown, or does it resume following where it's caught? Also, is this behavior consistent across most programming languages?</p>
| 3 | 2009-12-25T13:20:11Z | 1,961,310 | <p>I don't have my copy of Bjarne Stroustrup's "Design & Evolution" handy, but I believe he wrote in there about some experience with resumable exceptions. They found that they made things considerably harder to get correct. After all, if an unexpected error happens in some line, your exception handler then has t... | 2 | 2009-12-25T15:16:01Z | [
"c++",
"python",
"exception"
] |
Python: Separating the GUI process from the core logic process | 1,961,203 | <p>I'm developing a <a href="http://garlicsim.org">Python project</a> for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.</p>
<p>The way that th... | 12 | 2009-12-25T13:57:02Z | 1,961,218 | <p>You might find some inspiration here: <a href="http://wiki.wxpython.org/LongRunningTasks" rel="nofollow">http://wiki.wxpython.org/LongRunningTasks</a>, however it is for multithreading, not multiprocessing.</p>
<p>The basic idea</p>
<ul>
<li>for multithreading: use an event queue to communicate between the GUI and... | 6 | 2009-12-25T14:09:54Z | [
"python",
"user-interface",
"multiprocessing",
"user-experience"
] |
Python: Separating the GUI process from the core logic process | 1,961,203 | <p>I'm developing a <a href="http://garlicsim.org">Python project</a> for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.</p>
<p>The way that th... | 12 | 2009-12-25T13:57:02Z | 1,961,252 | <p>Unfortunately, although you're right that the choice of GUI doesn't affect the answer, the best approach to this problem will depend a lot on what exactly your simulation data is doing.</p>
<p>For example, if it generates sequential data then it can feed it to your GUI via a thread-safe or process-safe queue. But i... | 1 | 2009-12-25T14:40:55Z | [
"python",
"user-interface",
"multiprocessing",
"user-experience"
] |
Python: Separating the GUI process from the core logic process | 1,961,203 | <p>I'm developing a <a href="http://garlicsim.org">Python project</a> for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.</p>
<p>The way that th... | 12 | 2009-12-25T13:57:02Z | 1,961,259 | <p>To answer the specific questions.</p>
<p>"Do I use the <code>multiprocessing</code> package or the <code>subprocess</code> package to launch the new process?"</p>
<p>Use <code>multiprocessing</code></p>
<p>"How do I have easy access to the simulation data from the GUI process?"</p>
<p>You don't have access to th... | 2 | 2009-12-25T14:43:30Z | [
"python",
"user-interface",
"multiprocessing",
"user-experience"
] |
Python: Separating the GUI process from the core logic process | 1,961,203 | <p>I'm developing a <a href="http://garlicsim.org">Python project</a> for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.</p>
<p>The way that th... | 12 | 2009-12-25T13:57:02Z | 1,961,288 | <p>The simplest approach that can work for you here is launch the computation in a separate thread, and communicate data between this thread and the GUI using <code>Queue</code> objects. These are completely safe and very convenient for inter-thread communication.</p>
<p>Other solutions are more complex - you may end ... | 2 | 2009-12-25T15:00:20Z | [
"python",
"user-interface",
"multiprocessing",
"user-experience"
] |
Python: Separating the GUI process from the core logic process | 1,961,203 | <p>I'm developing a <a href="http://garlicsim.org">Python project</a> for dealing with computer simulations, and I'm also developing a GUI for it. (The core logic itself does not require a GUI.) The GUI toolkit I use for is wxPython, but I think my question is general enough not to depend on it.</p>
<p>The way that th... | 12 | 2009-12-25T13:57:02Z | 2,002,233 | <p>Mutiprocessing or Pyro with distributed data objects.</p>
<p><a href="http://pyro.sourceforge.net/" rel="nofollow">http://pyro.sourceforge.net/</a></p>
<p>Your simulation supplies distributed objects to the GUI, the GUI manipulates them and reads their attributes.</p>
<p>Both libraries will provide expandability ... | 0 | 2010-01-04T21:06:27Z | [
"python",
"user-interface",
"multiprocessing",
"user-experience"
] |
Python: Regex needed | 1,961,298 | <p>This is probably simple, but I can't figure this out:
I need regex expression which would extract following records (Each record may span multiple lines and delimited by one or more blank lines):</p>
<p>TextTextTextTextTextTextText</p>
<p>TextTextTextTextTextTextTextTextText</p>
<p>(one or more blank lines)</p>
... | 0 | 2009-12-25T15:08:30Z | 1,961,307 | <pre><code>import re
re.split('\n\n+', text)
</code></pre>
| 4 | 2009-12-25T15:14:37Z | [
"python",
"regex"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,343 | <p>The second argument is used to specify which random number generator to use. This could be useful if you need/have something "better" than <code>random.random</code>. Security-sensitive applications might need to use a cryptographically secure random number generator.</p>
<p>The difference between <code>random.rand... | 4 | 2009-12-25T15:39:02Z | [
"python",
"random"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,345 | <p>The docs go on saying:</p>
<blockquote>
<p>The optional argument random is a
0-argument function returning a random
float in [0.0, 1.0); by default, this
is the function random().</p>
</blockquote>
<p>It means that you can either specify your own random number generator function, or tell the module to use ... | 0 | 2009-12-25T15:39:09Z | [
"python",
"random"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,346 | <p>The shuffle function depends on an RNG (Random Number Generator), which defaults to random.random. The second argument is there so you can provide your own RNG instead of the default.</p>
<p><strong>UPDATE:</strong></p>
<p>The second argument is a random number generator that generates a new, random number in the ... | 0 | 2009-12-25T15:39:13Z | [
"python",
"random"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,348 | <p>From the <a href="http://docs.python.org/library/random.html" rel="nofollow">example</a>:</p>
<pre><code>>>> random.random() # Random float x, 0.0 <= x < 1.0
0.37444887175646646
</code></pre>
<p>It generates a random floating point number between 0 and 1.</p>
| 0 | 2009-12-25T15:41:36Z | [
"python",
"random"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,354 | <p>The second argument is the function which is called to produce random numbers that are in turn used to shuffle the sequence (first argument). The default function used if you don't provide your own is random.random.</p>
<p>You might want to provide this parameter if you want to customize how shuffle is performed.</... | 1 | 2009-12-25T15:43:17Z | [
"python",
"random"
] |
what exactly is random.random doing | 1,961,340 | <pre><code> random.shuffle(lst_shuffle, random.random)
</code></pre>
<p>I know the latter part is an optional argument. But what does it do exactly. I don't understand what this mean.
This is from the docs. </p>
<blockquote>
<p>random.random()¶
Return the next random floating point
number in the range [0.0,... | 1 | 2009-12-25T15:36:31Z | 1,961,646 | <p>Existing answers do a good job of addressing the question's specific, but I think it's worth mentioning a side issue: why you're particularly likely to want to pass an alternative "random generator" to <code>shuffle</code> as opposed to other functions in the <code>random</code> module. Quoting <a href="http://docs... | 5 | 2009-12-25T18:22:32Z | [
"python",
"random"
] |
Floating Point Concepts in Python | 1,961,394 | <p>Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.</p>
| 3 | 2009-12-25T15:59:51Z | 1,961,400 | <p>Because it's integer division by default. And integer division is rounded towards minus infinity. Take a look:</p>
<pre><code>>>> -22/10
-3
>>> -22/10.0
-2.2000000000000002
</code></pre>
<p>Positive:</p>
<pre><code>>>> 22/10
2
>>> 22/10.0
2.2000000000000002
</code></pre>
<p>Re... | 10 | 2009-12-25T16:01:10Z | [
"python",
"floating-point"
] |
Floating Point Concepts in Python | 1,961,394 | <p>Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.</p>
| 3 | 2009-12-25T15:59:51Z | 1,961,401 | <p>Because you're doing an integer division. If you do -22.0/10 instead, you'll get the correct result.</p>
| 2 | 2009-12-25T16:01:43Z | [
"python",
"floating-point"
] |
Floating Point Concepts in Python | 1,961,394 | <p>Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.</p>
| 3 | 2009-12-25T15:59:51Z | 1,961,409 | <p>By default, the current versions of Python 2.x (I'm not sure about 3.x) give an integer result for any arithmetic operator when both operands are integers. However, there is a way to change this behaviour.</p>
<pre><code>from __future__ import division
print(22/10)
</code></pre>
<p>Outputs</p>
<pre><code>2.200000... | 5 | 2009-12-25T16:06:55Z | [
"python",
"floating-point"
] |
Floating Point Concepts in Python | 1,961,394 | <p>Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.</p>
| 3 | 2009-12-25T15:59:51Z | 1,961,514 | <p><a href="http://www.python.org/dev/peps/pep-0238/" rel="nofollow">PEP 238</a>, "Changing the Division Operator", explains the issues well, I think. In brief: when Python was designed it adopted the "truncating" meaning for <code>/</code> between integers, simply because most other programming languages did ever sin... | 5 | 2009-12-25T17:10:31Z | [
"python",
"floating-point"
] |
Floating Point Concepts in Python | 1,961,394 | <p>Why Does -22/10 return -3 in python. Any pointers regarding this will be helpful for me.</p>
| 3 | 2009-12-25T15:59:51Z | 1,961,702 | <p>This happens because the operation of integer division returns the number, which when multiplied by the divisor gives the largest possible integer that is no larger than the number you divided.</p>
<p>This is exactly why 22/10 gives 2: 10*2=20, which is the largest integer multiple of 10 not bigger than 20.</p>
<p... | 2 | 2009-12-25T18:54:27Z | [
"python",
"floating-point"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 1,962,076 | <p>It should be enough to create an empty virtualenv and then copy the contents of the <code>.../site-packages/PyQt4</code> directories into it.</p>
<p>I suggest to install PyQt4 once globally, make a copy of the directory, uninstall it and then use this trick to create VEs.</p>
| 43 | 2009-12-25T22:17:40Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 4,673,823 | <p>I asked if it's possible to install PySide from within virtualenv on irc.freenode.net #pyside channel and got positive answer from <em>hugopl</em>. So I followed instructions from <a href="http://qt-project.org/wiki/PySide_Binaries_Windows" rel="nofollow">PySide Binaries for Microsoft Windows</a> and it worked. The ... | 7 | 2011-01-12T20:43:30Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 8,160,111 | <p>Expanding on Aaron Digulla's answer, using git to get the file list right can be really handy. I usually do something like this (from an msysGit shell):</p>
<pre><code># Create temp git repo for the pristine Python installation
$ cd /c/Python27
$ git init -q
$ git add .
$ git commit -qm "Initial commit"
</code></pr... | 2 | 2011-11-16T23:17:07Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 9,716,100 | <p>I have the same problem. I use virtualenvwrapper, so I wrote this script to create a link to PyQt in every new virtual environment. Maybe is useful for someone else:</p>
<pre><code>#!/bin/bash
# This hook is run after a new virtualenv is activated.
# ~/.virtualenvs/postmkvirtualenv
LIBS=( PyQt4 sip.so )
PYTHON_VE... | 41 | 2012-03-15T08:23:36Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 13,967,084 | <p>Let's assume your virtualenv is named myProject and you're using virtualenvwrapper. A Unix platform is also assumed.</p>
<pre><code>$ workon myProject
$ pip install --no-install SIP
$ pip install --no-install PyQt
$ cd ~/.virtualenvs/myProject/build/SIP
$ python configure.py
$ make
$ make install
$ cd ~/.virtualenv... | 6 | 2012-12-20T07:18:54Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 20,818,119 | <p>For PySide 1.2.1 and Ubuntu 12.4</p>
<p>Install compilers, Qt related, python sources </p>
<pre><code>sudo apt-get install cmake qt4-qmake qt-sdk python-dev
</code></pre>
<p>Create virt env with<code>virtualenvwrapper</code></p>
<p>Be ready for compiling Qt (~30 min) </p>
<pre><code>$ mkvirtualenv ve_name
(ve_n... | 4 | 2013-12-28T18:52:01Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 21,784,755 | <p>If you installed pyqt via brew on a Mac (specifically I'm on Mavericks):</p>
<pre><code>ln -s /usr/local/Cellar/sip/4.15.2/lib/python2.7/site-packages/*.* ~/{VIRTUALENVHOME}/{VIRTUALENVNAME}/lib/python2.7/site-packages
ln -s /usr/local/Cellar/pyqt/4.10.3/lib/python2.7/site-packages/PyQt4/ ~/{VIRTUALENVHOME}/{VIRTUA... | 2 | 2014-02-14T16:39:42Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 22,783,810 | <p>For those who want to use PyQt4 in a Python 3 virtualenv (on OSX) you first install PyQt4 and SIP (I will use homebrew)</p>
<pre><code>$ brew install python3
$ brew install sip --with-python3
$ brew install pyqt --with-python3
</code></pre>
<p>Then create your virtual environment </p>
<pre><code>$ virtualenv ...
... | 7 | 2014-04-01T10:56:45Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 26,699,367 | <p>Symbolic links may work.</p>
<p>I use Linux (Debian/sid), python 3.4, PySide, virtualenv, and PyCharm (IDE), but these same instructions will work for any package and development environment.</p>
<p>Symbolic links between <code>/usr/lib/python3/dist-packages/PySide/</code> <code>$VIRTUAL_ENV/lib/python3.4/site-pac... | 2 | 2014-11-02T12:37:59Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 28,850,104 | <p>Linux debian, python 2.7:</p>
<ul>
<li>Install python-qt4 globaly: <code>sudo apt-get install python-qt4</code></li>
<li>Create symbolic link of PyQt4 to your virtual env <code>ln -s /usr/lib/python2.7/dist-packages/PyQt4/ ~/.virtualenvs/myEnv/lib/python2.7/site-packages/</code></li>
<li>Create symbolic link of sip... | 20 | 2015-03-04T08:51:45Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
Is it possible to add PyQt4/PySide packages on a Virtualenv sandbox? | 1,961,997 | <p>I'm using <a href="http://pypi.python.org/pypi/virtualenv">Virtualenv</a> with profit on my development environment with <code>web.py</code>, <code>simplejson</code> and other web oriented packages.<br>
I'm going to develop a simple python client using Qt to reuse some Api developed with web.py. </p>
<p>Does anybo... | 47 | 2009-12-25T21:28:34Z | 34,339,605 | <p>What worked for me was copying <code>/PyQt4/</code> and <code>sip.x86_64-linux-gnu.so</code> from <code>/usr/lib/python2.7/dist-packages</code> to <code><VIRTUALENV>/lib/python2.7/site-packages</code> and changing the ownership permissions on these copied files (since the copies were owned by root).</p>
| 1 | 2015-12-17T16:27:52Z | [
"python",
"pyqt4",
"virtualenv",
"pyside"
] |
In memory database with socket capability | 1,962,130 | <p>Python --> SQLite --> ASP.NET C#</p>
<p>I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine.</p>
<p>I want to stay aw... | 0 | 2009-12-25T22:47:43Z | 1,962,162 | <p>The application of SQlite depends on your data complexity. </p>
<p>If you need to perform complex queries on relational data, then it might be a viable option. If your data is flat (i.e. not relational) and processed as a whole, then some python-internal data structures might be applicable.</p>
| 0 | 2009-12-25T22:58:21Z | [
"asp.net",
"python",
"sqlite",
"networking",
"udp"
] |
In memory database with socket capability | 1,962,130 | <p>Python --> SQLite --> ASP.NET C#</p>
<p>I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine.</p>
<p>I want to stay aw... | 0 | 2009-12-25T22:47:43Z | 1,962,192 | <p>Totally not my field, but I think <a href="http://simonwillison.net/2009/Oct/22/redis/" rel="nofollow">Redis</a> is along these lines.</p>
| 1 | 2009-12-25T23:17:19Z | [
"asp.net",
"python",
"sqlite",
"networking",
"udp"
] |
In memory database with socket capability | 1,962,130 | <p>Python --> SQLite --> ASP.NET C#</p>
<p>I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine.</p>
<p>I want to stay aw... | 0 | 2009-12-25T22:47:43Z | 1,962,382 | <p>Perhaps AppFabric would work for you?</p>
<p><a href="http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx</a></p>
| 0 | 2009-12-26T01:19:54Z | [
"asp.net",
"python",
"sqlite",
"networking",
"udp"
] |
In memory database with socket capability | 1,962,130 | <p>Python --> SQLite --> ASP.NET C#</p>
<p>I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine.</p>
<p>I want to stay aw... | 0 | 2009-12-25T22:47:43Z | 1,977,457 | <p>SQLite doesn't allow remote "connections" as far as I know, it only supports being invoked as an in-process library. However, you could try to use MySQL which, while heavier, supports remote connections and does have in-memory tables.
See <a href="http://dev.mysql.com/doc/refman/5.5/en/memory-storage-engine.html" re... | 0 | 2009-12-29T22:58:07Z | [
"asp.net",
"python",
"sqlite",
"networking",
"udp"
] |
In memory database with socket capability | 1,962,130 | <p>Python --> SQLite --> ASP.NET C#</p>
<p>I am looking for an in memory database application that does not have to write the data it receives to disc. Basically, I'll be having a Python server which receives gaming UDP data and translates the data and stores it in the memory database engine.</p>
<p>I want to stay aw... | 0 | 2009-12-25T22:47:43Z | 1,977,499 | <p>This sounds like a premature optimization (apologizes if you've already done the profiling). What I would suggest is go ahead and write the system in the simplest, cleanest way, but put a bit of abstraction around the database bits so they can easily by swapped out. Then profile it and find your bottleneck.</p>
<... | 1 | 2009-12-29T23:10:37Z | [
"asp.net",
"python",
"sqlite",
"networking",
"udp"
] |
PyQt documentation | 1,962,273 | <p>I have installed <em>PyQt GPL v4.6.2 for Python v3.1</em> and <em>Qt by Nokia v4.6.0 (OpenSource)</em>, but the documentation in PyQt is not coming up. Example docs are all blank, too.</p>
<p>Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get t... | 3 | 2009-12-25T23:56:06Z | 1,963,676 | <p>Whenever I need to look at documentation, I just search Google for the specific widget I am interested in. For example: <a href="http://www.google.com/search?q=QTreeWidget" rel="nofollow">QTreeWidget</a>. Sometimes you get an older version of Qt, but if you click the "similar" link in the search result, you can p... | 1 | 2009-12-26T16:10:31Z | [
"python",
"qt",
"pyqt"
] |
PyQt documentation | 1,962,273 | <p>I have installed <em>PyQt GPL v4.6.2 for Python v3.1</em> and <em>Qt by Nokia v4.6.0 (OpenSource)</em>, but the documentation in PyQt is not coming up. Example docs are all blank, too.</p>
<p>Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get t... | 3 | 2009-12-25T23:56:06Z | 1,966,523 | <p>The PyQt documentation is exactly as provided on the website, and as
included in the installer. It is not integrated with Assistant (it will be
in a future version). If you want to use Assistant then you can use the Qt
documentation instead (a lot of people do) and translate between C++ and
Python as you read it.</p... | 0 | 2009-12-27T17:47:08Z | [
"python",
"qt",
"pyqt"
] |
PyQt documentation | 1,962,273 | <p>I have installed <em>PyQt GPL v4.6.2 for Python v3.1</em> and <em>Qt by Nokia v4.6.0 (OpenSource)</em>, but the documentation in PyQt is not coming up. Example docs are all blank, too.</p>
<p>Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get t... | 3 | 2009-12-25T23:56:06Z | 1,970,223 | <p>Not sure about the standalone docs, but have you also looked at <i>(this post is a cw, so feel free to edit)</i>:</p>
<p><a href="http://pyqt.sourceforge.net/Docs/PyQt4/classes.html" rel="nofollow"><i>PyQt's Classes, adapted from the documentation provided with Qt4.</i></a></p>
<p>and</p>
<p><a href="http://www.c... | 1 | 2009-12-28T16:22:03Z | [
"python",
"qt",
"pyqt"
] |
PyQt documentation | 1,962,273 | <p>I have installed <em>PyQt GPL v4.6.2 for Python v3.1</em> and <em>Qt by Nokia v4.6.0 (OpenSource)</em>, but the documentation in PyQt is not coming up. Example docs are all blank, too.</p>
<p>Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get t... | 3 | 2009-12-25T23:56:06Z | 8,174,151 | <p>If you installed the Qt documentation, you should have an app named Assistant. This is a simple-minded browser for a local copy of the Qt doc as found at doc.qt.nokia.com. It is written for C++ but the mental translation to Python is not difficult, and it is nicely formatted and richly cross-linked. I keep Assistant... | 0 | 2011-11-17T20:53:59Z | [
"python",
"qt",
"pyqt"
] |
PyQt documentation | 1,962,273 | <p>I have installed <em>PyQt GPL v4.6.2 for Python v3.1</em> and <em>Qt by Nokia v4.6.0 (OpenSource)</em>, but the documentation in PyQt is not coming up. Example docs are all blank, too.</p>
<p>Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get t... | 3 | 2009-12-25T23:56:06Z | 14,584,725 | <p>Some out of date answers here. Best resources are:</p>
<p><a href="http://pyqt.sourceforge.net/Docs/PyQt4/" rel="nofollow">The Reference Guide</a></p>
<p>and</p>
<p><a href="http://pyqt.sourceforge.net/Docs/PyQt4/classes.html" rel="nofollow">The Class Reference Guide</a></p>
| 3 | 2013-01-29T14:00:18Z | [
"python",
"qt",
"pyqt"
] |
What does '_' do in Django code? | 1,962,287 | <p>Why does this Django code use <code>_</code> in front of 'has favicon'</p>
<pre><code>has_favicon = models.BooleanField(_('has favicon'))
</code></pre>
| 7 | 2009-12-26T00:04:41Z | 1,962,289 | <p>If you look in the import statements, you'll find that they tied _ to a function that turns stuff into unicode and localizes it by writing:</p>
<pre><code>from django.utils.translation import ugettext_lazy as _
</code></pre>
| 21 | 2009-12-26T00:07:48Z | [
"python",
"django",
"internationalization",
"gettext"
] |
What does '_' do in Django code? | 1,962,287 | <p>Why does this Django code use <code>_</code> in front of 'has favicon'</p>
<pre><code>has_favicon = models.BooleanField(_('has favicon'))
</code></pre>
| 7 | 2009-12-26T00:04:41Z | 1,962,290 | <p><code>_</code> is usually a macro/function from gettext, it means the argument is a localized string. this is not limited to Django or Python. in fact gettext is originally a package for C programs, ported to many other languages over the years.</p>
| 9 | 2009-12-26T00:08:07Z | [
"python",
"django",
"internationalization",
"gettext"
] |
What does '_' do in Django code? | 1,962,287 | <p>Why does this Django code use <code>_</code> in front of 'has favicon'</p>
<pre><code>has_favicon = models.BooleanField(_('has favicon'))
</code></pre>
| 7 | 2009-12-26T00:04:41Z | 1,965,858 | <p><code>_</code> in Django is a convention that is used for localizing texts. It is an alias for ugettext_lazy. Read <a href="https://docs.djangoproject.com/en/1.5/topics/i18n/translation/#lazy-translation" rel="nofollow">Lazy translation</a> in the docs for more info about it.</p>
| 9 | 2009-12-27T12:35:37Z | [
"python",
"django",
"internationalization",
"gettext"
] |
How can I get more intuitive feels about django relationships(like:Many-to-one,Many-to-many ) | 1,962,323 | <p>i use xampp(it has mysql)</p>
<p>I was Confused on this django relationships,
who can give me a code example(or text) to let me feel it intuitive .thanks
(like:Einstein described the theory of relativity)</p>
| 0 | 2009-12-26T00:37:01Z | 1,962,330 | <p>It's hard to answer a confused feeling question, but if you want code perhaps try <a href="http://www.djangosnippets.org/" rel="nofollow">http://www.djangosnippets.org/</a></p>
<p>Also the tutorial gives great examples on how the models work in such cases as many-to-many, see <a href="http://www.djangobook.com/en/1... | 0 | 2009-12-26T00:41:03Z | [
"python",
"sql",
"django"
] |
How can I get more intuitive feels about django relationships(like:Many-to-one,Many-to-many ) | 1,962,323 | <p>i use xampp(it has mysql)</p>
<p>I was Confused on this django relationships,
who can give me a code example(or text) to let me feel it intuitive .thanks
(like:Einstein described the theory of relativity)</p>
| 0 | 2009-12-26T00:37:01Z | 1,962,424 | <p>I looked all over for a simple explanation of relationships, but couldn't find anything, so I'll try to summarize it here.</p>
<p>Relationships aren't strictly a Django thing. If you really want to understand what Django is doing, learn about database concepts in general.</p>
<p><hr></p>
<p>When you have multiple... | 1 | 2009-12-26T01:48:19Z | [
"python",
"sql",
"django"
] |
I've never seen 'class __proxy__' before, what does this mean(I only have seen that like def __str__) | 1,962,368 | <p>this code is in the django.utils.functional.py</p>
<pre><code>class __proxy__(Promise):
</code></pre>
<p>thanks</p>
| 0 | 2009-12-26T01:16:24Z | 1,962,385 | <p>"Magic names", ones that start and end with double underscores, are reserved for the language in Python (but the compiler does not enforce that rule at present); Django is violating that rule, or setting itself up as "being the language" -- not a terrible sin, but an unpleasant practice.</p>
| 5 | 2009-12-26T01:20:09Z | [
"python",
"django"
] |
I've never seen 'class __proxy__' before, what does this mean(I only have seen that like def __str__) | 1,962,368 | <p>this code is in the django.utils.functional.py</p>
<pre><code>class __proxy__(Promise):
</code></pre>
<p>thanks</p>
| 0 | 2009-12-26T01:16:24Z | 1,962,386 | <p>It's just a name. And because it starts with <code>_</code> it's meant to be private to that module. </p>
<p>Why they chose that name? You'll have to ask the developers.</p>
| 1 | 2009-12-26T01:20:11Z | [
"python",
"django"
] |
why my code only print 'bbb' once,and it does not run wrong unexpectedly | 1,962,410 | <pre><code>class a:
class __b__(object):
print 'bbb'
b=a()
b.__b__()
b.__b__()
b.__b__()
a.__b__()
a.__b__()
a.__b__()
</code></pre>
<p>it print 'bbb' only once,
thanks</p>
| 0 | 2009-12-26T01:36:23Z | 1,962,415 | <p>You don't explain what you are trying to do, but I think what you mean is:</p>
<pre><code>class a:
def __b__(object):
print 'bbb'
</code></pre>
| 3 | 2009-12-26T01:42:31Z | [
"python"
] |
why my code only print 'bbb' once,and it does not run wrong unexpectedly | 1,962,410 | <pre><code>class a:
class __b__(object):
print 'bbb'
b=a()
b.__b__()
b.__b__()
b.__b__()
a.__b__()
a.__b__()
a.__b__()
</code></pre>
<p>it print 'bbb' only once,
thanks</p>
| 0 | 2009-12-26T01:36:23Z | 1,962,417 | <p>When python creates a class, it does so by executing the code within the class definition <strong>exactly once</strong>, therefore creating the class namespace, etc...</p>
<p>If you wanted it to run each time you called it, you need to put your code in the <code>__init__</code> method (which is the constructor).</p... | 4 | 2009-12-26T01:42:49Z | [
"python"
] |
why my code only print 'bbb' once,and it does not run wrong unexpectedly | 1,962,410 | <pre><code>class a:
class __b__(object):
print 'bbb'
b=a()
b.__b__()
b.__b__()
b.__b__()
a.__b__()
a.__b__()
a.__b__()
</code></pre>
<p>it print 'bbb' only once,
thanks</p>
| 0 | 2009-12-26T01:36:23Z | 1,962,420 | <p>The <code>class __b__</code> statement executes exactly once (when the <code>class a</code> statement executes) and that's the only case in which you're <code>print</code>int anything. The various instantiations are totally irrelevant (none of them has anything to do with the <code>print</code>ing).</p>
| 2 | 2009-12-26T01:43:37Z | [
"python"
] |
python source code conversion to uml diagram | 1,962,447 | <p>please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5
please help me find the solution, i have read the solution for the question on this website related to my topic but in vain</p>
| 0 | 2009-12-26T02:05:47Z | 1,962,599 | <p>I don't know about any direct solution, but some existing tools might help you in the process. The <a href="http://eric-ide.python-projects.org/" rel="nofollow">Eric Python IDE</a> supports generating class diagrams from Python code, for example.</p>
| 1 | 2009-12-26T04:08:42Z | [
"python"
] |
python source code conversion to uml diagram | 1,962,447 | <p>please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5
please help me find the solution, i have read the solution for the question on this website related to my topic but in vain</p>
| 0 | 2009-12-26T02:05:47Z | 1,964,328 | <ol>
<li>File / New Project / enter your project name.</li>
<li>In the Project Browser, create a package named "source"</li>
<li>Right-click the source package, "Code Engineering", "Import Source Directory".</li>
<li>Pick the directory containing your module(s) as the "Root Directory"</li>
<li>Set "Source Type" to Pyth... | 1 | 2009-12-26T20:50:25Z | [
"python"
] |
python source code conversion to uml diagram | 1,962,447 | <p>please let me know how to create a uml diagram along with its equivalent documentation for the source code(.py format) using enterprise architecture 7.5
please help me find the solution, i have read the solution for the question on this website related to my topic but in vain</p>
| 0 | 2009-12-26T02:05:47Z | 38,083,383 | <p>The best and easy way to generate the class diagram for python script is to use the Pycharm IDE. </p>
<ul>
<li>Step 1: Create a package for python script (Alt+InsertâPython Package)</li>
<li>Step 2: Right click on the created package file and select the option diagrams</li>
<li>Step 3: After selecting diagrams op... | 0 | 2016-06-28T18:09:14Z | [
"python"
] |
pylint PyQt4 error | 1,962,500 | <p>I write a program :</p>
<pre><code>from PyQt4.QtCore import *
from PyQt4.QtGui import *
def main():
app = QApplication([])
button = QPushButton("hello?")
button.show()
app.exec_()
if __name__=="__main__":
main()
</code></pre>
<p>the file name is t.py,
when I run:</p>
<pre><code>pylint t.py
<... | 1 | 2009-12-26T02:51:23Z | 1,962,520 | <p>I would check if you're using the very latest astng, pylint, etc.</p>
| 0 | 2009-12-26T03:03:51Z | [
"python",
"pyqt4",
"pylint"
] |
pylint PyQt4 error | 1,962,500 | <p>I write a program :</p>
<pre><code>from PyQt4.QtCore import *
from PyQt4.QtGui import *
def main():
app = QApplication([])
button = QPushButton("hello?")
button.show()
app.exec_()
if __name__=="__main__":
main()
</code></pre>
<p>the file name is t.py,
when I run:</p>
<pre><code>pylint t.py
<... | 1 | 2009-12-26T02:51:23Z | 1,969,400 | <p>Looks like a bug in <code>astng</code>. They try to read the name of a function which does not publish it (native extension func). I'd report a bug to both <code>astng</code> and <code>pyqt</code> projects. The first one would be that they should handle a no-name situation better. The second one would be that every ... | 1 | 2009-12-28T13:10:51Z | [
"python",
"pyqt4",
"pylint"
] |
Cannot use Python 2.6 C interface anymore, but 2.5 works | 1,962,545 | <p>I just noticed that I cannot use the Python 2.6 dll anymore. Python 2.5 works just fine.</p>
<pre><code>import ctypes
py1 = ctypes.cdll.python25
py2 = ctypes.cdll.python26
# ctypes.cdll.LoadLibrary("libpython2.6.so") in linux
py1.Py_Initialize()
py2.Py_Initialize()
# segmentation fault in Linux
py1.PyRun_Simple... | 0 | 2009-12-26T03:30:44Z | 1,962,568 | <p>Well, what I doubt you can do is load <em>both</em> 2.5 and 2.6 in the same process... Does ctypes.cdll.python26.Py_Initialize() alone work?</p>
<p>EDIT: wait, are you trying to load Python DLL from inside Python itself? wth?</p>
| 1 | 2009-12-26T03:49:22Z | [
"python",
"ctypes",
"python-2.6",
"python-2.5"
] |
Cannot use Python 2.6 C interface anymore, but 2.5 works | 1,962,545 | <p>I just noticed that I cannot use the Python 2.6 dll anymore. Python 2.5 works just fine.</p>
<pre><code>import ctypes
py1 = ctypes.cdll.python25
py2 = ctypes.cdll.python26
# ctypes.cdll.LoadLibrary("libpython2.6.so") in linux
py1.Py_Initialize()
py2.Py_Initialize()
# segmentation fault in Linux
py1.PyRun_Simple... | 0 | 2009-12-26T03:30:44Z | 1,962,787 | <p>What you are doing is wrong. You are clearly running Python 2.6 and then trying to initialize the shared library in the same process (and thread), which is going to crash (if you're lucky...if you're not it's going to cause you very ugly trouble later). You should never, ever, try to load Python into itself and ca... | 2 | 2009-12-26T07:06:45Z | [
"python",
"ctypes",
"python-2.6",
"python-2.5"
] |
how can i get all of python Reserved Words which has 4 Underline(__str__),because django made many function with 4 '_'too | 1,962,559 | <p>i can't Distinguish them </p>
<p>for example in django:</p>
<pre><code>def __wrapper__
def __deepcopy__
def __mod__
def __cmp__
</code></pre>
<p>thanks</p>
| 0 | 2009-12-26T03:43:05Z | 1,962,579 | <p>You can find most of them here: <a href="http://docs.python.org/genindex-all.html#%5F" rel="nofollow">http://docs.python.org/genindex-all.html#_</a></p>
<p>identifiers with 2 leading+2 trailing underscores are of course reserved for <a href="http://docs.python.org/reference/lexical%5Fanalysis.html#reserved-classes-... | 1 | 2009-12-26T03:56:56Z | [
"python",
"django"
] |
how can i get all of python Reserved Words which has 4 Underline(__str__),because django made many function with 4 '_'too | 1,962,559 | <p>i can't Distinguish them </p>
<p>for example in django:</p>
<pre><code>def __wrapper__
def __deepcopy__
def __mod__
def __cmp__
</code></pre>
<p>thanks</p>
| 0 | 2009-12-26T03:43:05Z | 1,962,588 | <p>A list of special method names is <a href="http://docs.python.org/reference/datamodel.html#special-method-names">here</a>, but it's not an exhaustive of magic names -- for example, methods <code>__copy__</code> and <code>__deepcopy__</code> are mentioned <a href="http://docs.python.org/library/copy.html?highlight=%5... | 5 | 2009-12-26T04:00:39Z | [
"python",
"django"
] |
how can i get all of python Reserved Words which has 4 Underline(__str__),because django made many function with 4 '_'too | 1,962,559 | <p>i can't Distinguish them </p>
<p>for example in django:</p>
<pre><code>def __wrapper__
def __deepcopy__
def __mod__
def __cmp__
</code></pre>
<p>thanks</p>
| 0 | 2009-12-26T03:43:05Z | 1,962,591 | <p>To print Python's reserved words just use</p>
<pre><code>>>> import keyword
>>> print(keyword.kwlist)
['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue',
'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global',
'if', 'import', 'in', 'is', 'lambda', 'no... | 8 | 2009-12-26T04:01:23Z | [
"python",
"django"
] |
How do I make a simple file browser in wxPython? | 1,962,592 | <p>I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance!</p>
<p>EDIT:
a sort of side question, how m... | 4 | 2009-12-26T04:02:57Z | 1,962,595 | <p>You can take a look at the wxPython examples, they also include code samples for almost all of the widgets supported by wxPython. If you use Windows they can be found in the Start Menu folder of WxPython.</p>
| 1 | 2009-12-26T04:06:23Z | [
"python",
"wxpython"
] |
How do I make a simple file browser in wxPython? | 1,962,592 | <p>I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance!</p>
<p>EDIT:
a sort of side question, how m... | 4 | 2009-12-26T04:02:57Z | 1,962,713 | <p>I think that the <a href="http://www.wxpython.org/docs/api/wx.GenericDirCtrl-class.html">GenericDirCtrl</a> widget could be of use for you. <a href="http://wiki.wxpython.org/AnotherTutorial">This tutorial</a> has many examples, among them a simple usage of that widget in a complete script (screenshot pasted below). ... | 8 | 2009-12-26T06:10:12Z | [
"python",
"wxpython"
] |
How do I make a simple file browser in wxPython? | 1,962,592 | <p>I'm starting to learn both Python and wxPython and as part of the app I'm doing, I need to have a simple browser on the left pane of my app. I'm wondering how do I do it? Or at least point me to the right direction that'll help me more on how to do one. Thanks in advance!</p>
<p>EDIT:
a sort of side question, how m... | 4 | 2009-12-26T04:02:57Z | 1,962,747 | <p>Sample for wx.html.HtmlWindow</p>
<pre><code>import wx
import wx.html
class MyHtmlFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, size=(600,400))
html = wx.html.HtmlWindow(self)
wx.CallAfter(html.LoadPage, "http://www.google.com")
app = wx... | 0 | 2009-12-26T06:34:55Z | [
"python",
"wxpython"
] |
How to get alpha value of a PNG image with PIL? | 1,962,795 | <p>How to detect if a PNG image has transparent alpha channel or not using PIL?</p>
<pre><code>img = Image.open('example.png', 'r')
has_alpha = img.mode == 'RGBA'
</code></pre>
<p>With above code we know whether a PNG image has alpha channel not not but how to get the alpha value?</p>
<p>I didn't find a 'transparenc... | 14 | 2009-12-26T07:15:36Z | 1,962,816 | <p>The <code>img.info</code> is about the image as a whole -- the alpha-value in an RGBA image is per-pixel, so of course it won't be in <code>img.info</code>. The <code>getpixel</code> method of the image object, given a coordinate as argument, returns a tuple with the values of the (four, in this case) bands for tha... | 2 | 2009-12-26T07:31:15Z | [
"python",
"image",
"png",
"python-imaging-library",
"transparent"
] |
How to get alpha value of a PNG image with PIL? | 1,962,795 | <p>How to detect if a PNG image has transparent alpha channel or not using PIL?</p>
<pre><code>img = Image.open('example.png', 'r')
has_alpha = img.mode == 'RGBA'
</code></pre>
<p>With above code we know whether a PNG image has alpha channel not not but how to get the alpha value?</p>
<p>I didn't find a 'transparenc... | 14 | 2009-12-26T07:15:36Z | 1,963,141 | <pre><code># python 2.6+
import operator, itertools
def get_alpha_channel(image):
"Return the alpha channel as a sequence of values"
# first, which band is the alpha channel?
try:
alpha_index= image.getbands().index('A')
except ValueError:
return None # no alpha channel, presumably
... | 2 | 2009-12-26T11:05:21Z | [
"python",
"image",
"png",
"python-imaging-library",
"transparent"
] |
How to get alpha value of a PNG image with PIL? | 1,962,795 | <p>How to detect if a PNG image has transparent alpha channel or not using PIL?</p>
<pre><code>img = Image.open('example.png', 'r')
has_alpha = img.mode == 'RGBA'
</code></pre>
<p>With above code we know whether a PNG image has alpha channel not not but how to get the alpha value?</p>
<p>I didn't find a 'transparenc... | 14 | 2009-12-26T07:15:36Z | 1,963,146 | <p>To get the alpha layer of an RGBA image all you need to do is:</p>
<pre><code>red, green, blue, alpha = img.split()
</code></pre>
<p>or</p>
<pre><code>alpha = img.split()[-1]
</code></pre>
<p>And there is a method to set the alpha layer:</p>
<pre><code>img.putalpha(alpha)
</code></pre>
<p>The transparency key ... | 33 | 2009-12-26T11:06:04Z | [
"python",
"image",
"png",
"python-imaging-library",
"transparent"
] |
How to get alpha value of a PNG image with PIL? | 1,962,795 | <p>How to detect if a PNG image has transparent alpha channel or not using PIL?</p>
<pre><code>img = Image.open('example.png', 'r')
has_alpha = img.mode == 'RGBA'
</code></pre>
<p>With above code we know whether a PNG image has alpha channel not not but how to get the alpha value?</p>
<p>I didn't find a 'transparenc... | 14 | 2009-12-26T07:15:36Z | 1,963,161 | <p>You can get the alpha data out of whole image in one go by converting image to string with 'A' mode e.g this example get alpha data out of image and saves it as grey scale image :)</p>
<pre><code>from PIL import Image
imFile="white-arrow.png"
im = Image.open(imFile, 'r')
print im.mode == 'RGBA'
rgbData = im.tostr... | 4 | 2009-12-26T11:10:48Z | [
"python",
"image",
"png",
"python-imaging-library",
"transparent"
] |
I wan to print 'eee fff {'e':'eee','f':'fff'}',how can i get it. (it is about __setattr__) | 1,962,919 | <p>the next is my code:</p>
<pre><code>class a:
w={}
def __setattr__(self,name,value):
self.w[name]=value
def __getattr__(self,name):
return self.w[name]
b=a()
b.e='eee'
b['f']='fff'
print b.e,b['f'],b.w
#error
</code></pre>
<p>what is the difference between b.e and b['f'].
thanks</p>
| 0 | 2009-12-26T08:35:40Z | 1,962,922 | <p>__ set/getitem__() are used for indexing. Define them as well.</p>
| 1 | 2009-12-26T08:38:35Z | [
"python"
] |
I wan to print 'eee fff {'e':'eee','f':'fff'}',how can i get it. (it is about __setattr__) | 1,962,919 | <p>the next is my code:</p>
<pre><code>class a:
w={}
def __setattr__(self,name,value):
self.w[name]=value
def __getattr__(self,name):
return self.w[name]
b=a()
b.e='eee'
b['f']='fff'
print b.e,b['f'],b.w
#error
</code></pre>
<p>what is the difference between b.e and b['f'].
thanks</p>
| 0 | 2009-12-26T08:35:40Z | 1,962,963 | <pre><code>class MyClass(object):
def __init__(self):
self.w = {}
def __setitem__(self, k, v):
self.w[k] = v
def __getitem__(self, k):
return self.w[k]
mc = MyClass()
mc['aa'] = 12
print mc['aa']
</code></pre>
<p>setitem/getitem is for indexed access (with square brackets) like ... | 1 | 2009-12-26T09:02:07Z | [
"python"
] |
I wan to print 'eee fff {'e':'eee','f':'fff'}',how can i get it. (it is about __setattr__) | 1,962,919 | <p>the next is my code:</p>
<pre><code>class a:
w={}
def __setattr__(self,name,value):
self.w[name]=value
def __getattr__(self,name):
return self.w[name]
b=a()
b.e='eee'
b['f']='fff'
print b.e,b['f'],b.w
#error
</code></pre>
<p>what is the difference between b.e and b['f'].
thanks</p>
| 0 | 2009-12-26T08:35:40Z | 1,963,401 | <p>You have not defined any method/attribute called <code>self.e</code></p>
<p>If instead, you were to say <code>self.w[e] = 'eee'</code>, then you're errors should disappear.</p>
| 0 | 2009-12-26T13:36:15Z | [
"python"
] |
Selecting rows from a NumPy ndarray | 1,962,980 | <p>I want to select only certain rows from a <a href="http://en.wikipedia.org/wiki/NumPy">NumPy</a> array based on the value in the second column. For example, this test array has integers from 1 to 10 in the second column.</p>
<pre><code>>>> test = numpy.array([numpy.arange(100), numpy.random.randint(1, 11, ... | 18 | 2009-12-26T09:14:12Z | 1,963,045 | <pre><code>test[numpy.logical_or.reduce([test[:,1] == x for x in wanted])]
</code></pre>
<p>The result should be faster than the original version since NumPy's doing the inner loops instead of Python.</p>
| 13 | 2009-12-26T10:12:28Z | [
"python",
"numpy"
] |
Selecting rows from a NumPy ndarray | 1,962,980 | <p>I want to select only certain rows from a <a href="http://en.wikipedia.org/wiki/NumPy">NumPy</a> array based on the value in the second column. For example, this test array has integers from 1 to 10 in the second column.</p>
<pre><code>>>> test = numpy.array([numpy.arange(100), numpy.random.randint(1, 11, ... | 18 | 2009-12-26T09:14:12Z | 1,963,113 | <p>The following solution should be faster than Amnon's solution as <code>wanted</code> gets larger:</p>
<pre><code>wanted_set = set(wanted) # Much faster look up than with lists, for larger lists
@numpy.vectorize
def selected(elmt): return elmt in wanted_set # Or: selected = numpy.vectorize(wanted_set.__contains__... | 24 | 2009-12-26T10:56:50Z | [
"python",
"numpy"
] |
Selecting rows from a NumPy ndarray | 1,962,980 | <p>I want to select only certain rows from a <a href="http://en.wikipedia.org/wiki/NumPy">NumPy</a> array based on the value in the second column. For example, this test array has integers from 1 to 10 in the second column.</p>
<pre><code>>>> test = numpy.array([numpy.arange(100), numpy.random.randint(1, 11, ... | 18 | 2009-12-26T09:14:12Z | 1,963,978 | <p>This is two times faster than Amnon's variant for len(test)=1000:</p>
<pre><code>wanted = (2,4,6)
wanted2 = numpy.expand_dims(wanted, 1)
print test[numpy.any(test[:, 1] == wanted2, 0), :]
</code></pre>
| 0 | 2009-12-26T18:22:52Z | [
"python",
"numpy"
] |
Selecting rows from a NumPy ndarray | 1,962,980 | <p>I want to select only certain rows from a <a href="http://en.wikipedia.org/wiki/NumPy">NumPy</a> array based on the value in the second column. For example, this test array has integers from 1 to 10 in the second column.</p>
<pre><code>>>> test = numpy.array([numpy.arange(100), numpy.random.randint(1, 11, ... | 18 | 2009-12-26T09:14:12Z | 24,519,114 | <p><a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.in1d.html" rel="nofollow">numpy.in1d</a> is what you are looking for:</p>
<pre><code>print test[numpy.in1d(test[:,1], wanted)]
</code></pre>
<p>It should easily be the fastest solution if wanted is large; plus, it is the most readable one, id say.<... | 5 | 2014-07-01T20:54:19Z | [
"python",
"numpy"
] |
What is the significance of a function without a 'self' argument insde a class? | 1,962,983 | <pre><code>class a:
def b():
...
</code></pre>
<p>what is the Significance of b</p>
<p>thanks</p>
<p><hr></p>
<pre><code>class a:
@staticmethod
def b():
return 1
def c(self):
b()
print a.b()
print a().b()
print a().c()#error
</code></pre>
<p>and </p>
<pre><code>class a... | 4 | 2009-12-26T09:16:33Z | 1,962,993 | <p>Syntax error. Try calling it.</p>
<pre><code>>>> class a:
... def b():
... return 1
...
>>> x=a()
>>> x.b()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: b() takes no arguments (1 given)
</code></pre>
<p>See also:</p>
<p... | 4 | 2009-12-26T09:27:13Z | [
"python",
"class"
] |
What is the significance of a function without a 'self' argument insde a class? | 1,962,983 | <pre><code>class a:
def b():
...
</code></pre>
<p>what is the Significance of b</p>
<p>thanks</p>
<p><hr></p>
<pre><code>class a:
@staticmethod
def b():
return 1
def c(self):
b()
print a.b()
print a().b()
print a().c()#error
</code></pre>
<p>and </p>
<pre><code>class a... | 4 | 2009-12-26T09:16:33Z | 1,963,007 | <p>Basically you should use b() as staticmethod so that you can call it either from Class or Object of class e.g:</p>
<pre><code>bash-3.2$ python
Python 2.6 (trunk:66714:66715M, Oct 1 2008, 18:36:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more inf... | 4 | 2009-12-26T09:44:10Z | [
"python",
"class"
] |
What is the significance of a function without a 'self' argument insde a class? | 1,962,983 | <pre><code>class a:
def b():
...
</code></pre>
<p>what is the Significance of b</p>
<p>thanks</p>
<p><hr></p>
<pre><code>class a:
@staticmethod
def b():
return 1
def c(self):
b()
print a.b()
print a().b()
print a().c()#error
</code></pre>
<p>and </p>
<pre><code>class a... | 4 | 2009-12-26T09:16:33Z | 1,963,182 | <p>in a class method <code>self</code> is the instance of the class the method is called on. beware that <code>self</code> is not a keyword in python just a conventional name given to the first argument of a method.</p>
<p>look at this example:</p>
<pre><code>class A:
def foo(self):
print "I'm a.foo"
... | 1 | 2009-12-26T11:19:02Z | [
"python",
"class"
] |
How to use on_mouse_motion to move around a lable via pyglet? | 1,963,003 | <p>How can one move a label around in the hello world example using the on_mouse_motion function? </p>
<p>The docs aren't clicking for me.</p>
<p><a href="http://www.pyglet.org/doc/programming%5Fguide/mouse%5Fevents.html" rel="nofollow">on_mouse-motion</a></p>
<p><a href="http://www.pyglet.org/doc/programming%5Fguid... | 1 | 2009-12-26T09:39:57Z | 1,963,121 | <p>Figured it out: Don't know if this is the most efficient solution though.</p>
<p>EDIT -> fixed for just xy.</p>
<pre><code>#!/usr/bin/env python
import pyglet
window = pyglet.window.Window()
fps_display = pyglet.clock.ClockDisplay()
label = pyglet.text.Label('Hello World!',font_name='Arial',font_size=36, x=0, y=... | 2 | 2009-12-26T10:59:47Z | [
"python",
"pyglet"
] |
Render and scroll through multiline paragraphs using pyglet and ScrollableTextLayout | 1,963,171 | <p>How can one display and scroll through a multi-line strings (contain "\n") via pyglet using the features of ScrollableTextLayout?</p>
<p><a href="http://www.pyglet.org/doc/api/pyglet.text.layout-module.html" rel="nofollow">STL crops what is display, and seems to be the most efficient way to implement scrolling.</a>... | 0 | 2009-12-26T11:16:21Z | 1,963,853 | <p>You create one like this:</p>
<pre><code>scroll_area = pyglet.text.layout.ScrollableTextLayout(my_text, width, height, multiline=True)
</code></pre>
<p>And you choose your scroll position with the view_x and view_y values.</p>
<pre><code>scroll_area.view_y = 30 # start 30 pixels down
</code></pre>
<p>Set differe... | 0 | 2009-12-26T17:19:12Z | [
"python",
"scroll",
"multiline",
"pyglet"
] |
How to append '\\?\' to the front of a file path in Python | 1,963,302 | <p>I'm trying to work with some long file paths (Windows) in Python and have come across some problems. After reading the question <a href="http://stackoverflow.com/questions/1365797/python-long-filename-support-broken-in-windows">here</a>, it looks as though I need to append '\\?\' to the front of my long file paths ... | 0 | 2009-12-26T12:46:37Z | 1,963,307 | <p>"\\\\?\\" should give you exactly the string you want.</p>
<p>Longer answer: of course you can end a string in Python with a backslash. You just can't do so when it's a "raw" string (one prefixed with an 'r'). Which you usually use for strings that contains (lots of) backslashes (to avoid the infamous "leaning to... | 3 | 2009-12-26T12:49:11Z | [
"python",
"filepath",
"backslash"
] |
How to append '\\?\' to the front of a file path in Python | 1,963,302 | <p>I'm trying to work with some long file paths (Windows) in Python and have come across some problems. After reading the question <a href="http://stackoverflow.com/questions/1365797/python-long-filename-support-broken-in-windows">here</a>, it looks as though I need to append '\\?\' to the front of my long file paths ... | 0 | 2009-12-26T12:46:37Z | 1,964,429 | <p>Even with a raw string, you can end in a backslash with:</p>
<pre><code>>>> print r'\\?\D:\Blah' + '\\'
\\?\D:\Blah\
</code></pre>
<p>or even:</p>
<pre><code>>>> print r'\\?\D:\Blah' '\\'
\\?\D:\Blah\
</code></pre>
<p>since Python concatenates to literal strings into one.</p>
| 0 | 2009-12-26T21:31:29Z | [
"python",
"filepath",
"backslash"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,963,397 | <p>Sorry, no, there's no such thing. In string literals, anyway... you could perhaps piggyback on another encoding scheme, such as HTML:</p>
<pre><code>>>> import HTMLParser
>>> HTMLParser.HTMLParser().unescape(u'a &auml; b c')
u'a \xe4 b'
</code></pre>
<p>But I don't think this'd be worth it.</... | 3 | 2009-12-26T13:34:05Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,963,489 | <p>Have you thought about writing your own converter? It wouldn't be hard to write something that would go through a file and replace \N{A umlaut} with \N{LATIN SMALL LETTER A WITH DIAERESIS} and all the rest.</p>
| 0 | 2009-12-26T14:19:32Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,963,584 | <p>If you want to do the right thing please <strong>use UTF-8 in your python source code</strong>. This will keep the code much more readable.</p>
<p>Python is able to real UTF-8 source files, all you have to do is to add an additional line after the first one:</p>
<pre><code>#!/usr/bin/python
# -*- coding: UTF-8 -*-... | 3 | 2009-12-26T15:11:25Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,963,589 | <p>You can put an actual "ä" character in your string. For this you have to declare the encoding of the source code at the top</p>
<pre><code>#!/usr/bin/env python
# encoding: utf-8
x = u"ä"
</code></pre>
| 1 | 2009-12-26T15:14:33Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,963,599 | <p>You can use the Unicode notation <code>\uXXXX</code> do describe that character:</p>
<pre><code>u"\u00E4"
</code></pre>
| 0 | 2009-12-26T15:21:18Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
short Unicode \N{} names for Latin-1 characters in Python? | 1,963,353 | <p>Are there short Unicode u"\N{...}" names for Latin1 characters in Python ?
\N{A umlaut} etc. would be nice,<br>
\N{LATIN SMALL LETTER A WITH DIAERESIS} etc. is just too long to type every time.<br>
(Added:) I use an English keyboard, but occasionally need German letters, as in "Löwenbräu WeiÃbier".<br>
Yes one ca... | 3 | 2009-12-26T13:15:59Z | 1,964,418 | <p>On Windows, you can use the charmap.exe utility to look up the keyboard shortcut for common letters you're using such as:</p>
<pre><code>ALT-0223 = Ã
ALT-0228 = ä
ALT-0246 = ö
</code></pre>
<p>Then use Unicode and save in UTF-8:</p>
<pre><code># -*- coding: UTF-8 -*-
phrase = u'Löwenbräu WeiÃbier'
</code></... | 0 | 2009-12-26T21:25:06Z | [
"python",
"unicode",
"encoding",
"utf-8"
] |
Extending Python: pre-load my C module | 1,963,453 | <p>I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.</p>
<p>Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type <code>import <mymodule>... | 1 | 2009-12-26T14:05:57Z | 1,963,505 | <p>Nope. You could add it to the Python interpreter itself, but that would mean creating a custom Python version, which, I guess, is not what you want.</p>
<p>That <code>import <mymodule></code> is not just for loading the module, it's also for making this module visible in the (main|current) namespace. Being ab... | 0 | 2009-12-26T14:30:34Z | [
"python",
"c",
"import",
"python-c-api",
"python-embedding"
] |
Extending Python: pre-load my C module | 1,963,453 | <p>I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.</p>
<p>Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type <code>import <mymodule>... | 1 | 2009-12-26T14:05:57Z | 1,963,510 | <p>Even if you implement a module in Python, the user would have to <code>import</code> it. This is the way Python works, and it's actually <em>a good thing</em> - it's one of the great pluses of Python - the namespace/module system is robust, easy to use and simple to understand.</p>
<p>For academic exercises only, y... | 3 | 2009-12-26T14:34:34Z | [
"python",
"c",
"import",
"python-c-api",
"python-embedding"
] |
Extending Python: pre-load my C module | 1,963,453 | <p>I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.</p>
<p>Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type <code>import <mymodule>... | 1 | 2009-12-26T14:05:57Z | 1,963,606 | <p>In general, no. But if your users are only going to be using your module in interactive sessions, and you can set their environmental variables, you can set the <a href="http://docs.python.org/tutorial/interpreter.html#the-interactive-startup-file" rel="nofollow">PYTHONSTARTUP environmental variable</a> to a script... | 2 | 2009-12-26T15:25:31Z | [
"python",
"c",
"import",
"python-c-api",
"python-embedding"
] |
Extending Python: pre-load my C module | 1,963,453 | <p>I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.</p>
<p>Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type <code>import <mymodule>... | 1 | 2009-12-26T14:05:57Z | 1,963,609 | <p>If you really want to do this, set your <a href="http://docs.python.org/using/cmdline.html#envvar-PYTHONSTARTUP" rel="nofollow"><code>PYTHONSTARTUP</code></a> environment variable to point to a file. In <code>sh</code>, <code>ksh</code>, <code>bash</code> etc., you can do:</p>
<pre><code>PYTHONSTARTUP=$HOME/.pysta... | 1 | 2009-12-26T15:26:01Z | [
"python",
"c",
"import",
"python-c-api",
"python-embedding"
] |
Extending Python: pre-load my C module | 1,963,453 | <p>I'm trying to extend Python interpreter by a few C functions I wrote. From reading docs, to expose those function the user has to import the module encompassing the functions.</p>
<p>Is it possible to load pre-load or pre-import via C API the module so that the user doesn't have to type <code>import <mymodule>... | 1 | 2009-12-26T14:05:57Z | 12,025,379 | <p>Check out this blog post on how to pre-import modules in embedded python.</p>
<blockquote>
<p><a href="http://blog.dmaggot.org/2009/12/embed-python-and-import-modules-in-cc/" rel="nofollow">Embed Python and Import Modules in C/C++</a></p>
</blockquote>
<p>For example to simulate the following statement in Python... | 0 | 2012-08-19T08:59:49Z | [
"python",
"c",
"import",
"python-c-api",
"python-embedding"
] |
Time complexity of accessing a Python dict | 1,963,507 | <p>I am writing a simple Python program. </p>
<p>My program seems to suffer from linear access to dictionaries,
its run-time grows exponentially even though the algorithm is quadratic.<br>
I use a dictionary to memoize values. That seems to be a bottleneck. </p>
<p>The values I'm hashing are tuples of points.
Each... | 7 | 2009-12-26T14:32:01Z | 1,963,512 | <p>You are not correct. <code>dict</code> access is unlikely to be your problem here. It is almost certainly O(1), unless you have some very weird inputs or a very bad hashing function. Paste some sample code from your application for a better diagnosis.</p>
| 3 | 2009-12-26T14:35:48Z | [
"python",
"hash",
"dictionary",
"complexity-theory"
] |
Time complexity of accessing a Python dict | 1,963,507 | <p>I am writing a simple Python program. </p>
<p>My program seems to suffer from linear access to dictionaries,
its run-time grows exponentially even though the algorithm is quadratic.<br>
I use a dictionary to memoize values. That seems to be a bottleneck. </p>
<p>The values I'm hashing are tuples of points.
Each... | 7 | 2009-12-26T14:32:01Z | 1,963,514 | <p>See <a href="http://wiki.python.org/moin/TimeComplexity">Time Complexity</a>. The python dict is a hashmap, its worst case is therefore O(n) if the hash function is bad and results in a lot of collisions. However that is a very rare case where every item added has the same hash and so is added to the same chain whic... | 19 | 2009-12-26T14:36:44Z | [
"python",
"hash",
"dictionary",
"complexity-theory"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.