Re: Terrible FPU performance

2011-04-26 Thread Chris Colbert
On Tue, Apr 26, 2011 at 8:40 AM, Mihai Badoiu wrote: > Hi, > > I have terrible performance for multiplication when one number gets very > close to zero. I'm using cython by writing the following code: > > You should ask this question on the Cython users mailing list. -- http://mail.python.org/m

Re: a basic bytecode to machine code compiler

2011-04-02 Thread Chris Colbert
> > > That's quite an interesting idea. I do think a lot of production Python > code implicitly depends on the GIL and would need rework for multicore. > For example, code that expects "n += 1" to be atomic, because the > CPython bytecode interpreter won't switch threads in the middle of it. > --

Re: [newbie/2.5.1.1] Computing value of a word?

2011-02-16 Thread Chris Colbert
On Wed, Feb 16, 2011 at 4:27 AM, Chris Rebert wrote: > On Wed, Feb 16, 2011 at 1:17 AM, Gilles Ganault wrote: > > Hello, > > > > For a game, I need to go through a wordlist, and for each word, > > compute its value, ie. a=1, b=2, etc. > > > > So for instance, NewYork = 14 + 5 + 23 + 25 + 15 + 18

Re: palindrome iteration

2010-09-12 Thread Chris Colbert
;) In [29]: s = 'bannab' In [30]: a = np.frombuffer(s.lower(), dtype='uint8') In [31]: np.all(a == a[::-1]) Out[31]: True In [32]: s = 'bannac' In [33]: a = np.frombuffer(s.lower(), dtype='uint8') In [34]: np.all(a == a[::-1]) Out[34]: False -- http://mail.python.org/mailman/listinfo/pytho

ANN: Pymazon 0.9 released!

2010-06-26 Thread Chris Colbert
I am happy to announce the 0.9 release of Pymazon. http://code.google.com/p/pymazon/ Pymazon is a Python implemented downloader for the Amazon MP3 store. This release is a near-full rewrite which brings a brand new GUI design and a host of new features: Notably: - Pymazon now supports MP3 downl

Re: how to get text from a html file?

2010-04-13 Thread Chris Colbert
On Tue, Apr 13, 2010 at 1:58 PM, varnikat t wrote: > > Hi, > Can anyone tell me how to get text from a html file?I am trying to display > the text of an html file in textview(of glade).If i directly display the > file,it shows with html tags and attributes, etc. in textview.I don't want > that.I j

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 2:34 PM, Tobiah wrote: >> How does that answer your original question? > > I was able to do this: > > import colorsys > > sat = 1 > value = 1 > length = 1000 > for x in range(0, length + 1): >        hue = x / float(length) >        color = list(colorsys.hsv_to_rgb(hue, sat,

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 1:14 PM, Tobiah wrote: >> Look at the colorsys module. >> >> http://docs.python.org/library/colorsys.html?highlight=colorsys#module- > colorsys > > That so rocks.  Thanks! > -- > http://mail.python.org/mailman/listinfo/python-list > How does that answer your original questi

Re: Generating a rainbow?

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 12:46 PM, Tobiah wrote: > I'm having a difficult time with this.  I want > to display a continuous range of hues using HTML > hex representation (#RRGGBB).  How would I go > about scanning through the hues in order to > make a rainbow? > > Thanks, > > Toby > -- > http://mail

Re: How to open and read an unknown extension file

2010-04-08 Thread Chris Colbert
On Thu, Apr 8, 2010 at 11:42 AM, Kushal Kumaran wrote: > On Thu, Apr 8, 2010 at 9:00 PM, varnikat t wrote: >> I am trying to do this >> if os.path.exists("*.*.txt"): >>             file=open("*.*.txt") >>             self.text_view.get_buffer().set_text(file.read()) >> else: >>             file=o

Re: get objects from image

2010-04-08 Thread Chris Colbert
lookup "connected component labeling" in a machine vision book. On Thu, Apr 8, 2010 at 9:57 AM, Chris Hulan wrote: > On Apr 8, 9:17 am, Jannis Syntychakis wrote: >> Hallo Everybody, >> >> Maybe you can help me with this: >> >> i have a picture. The picture is black, with some white objects. >> >

Re: python as pen and paper substitute

2010-04-06 Thread Chris Colbert
you may have a look at sage: http://www.sagemath.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Performance of list vs. set equality operations

2010-04-06 Thread Chris Colbert
:slaps forehead: good catch. On Tue, Apr 6, 2010 at 5:18 PM, Gustavo Narea wrote: > On Apr 6, 7:28 pm, Chris Colbert wrote: >> the proof is in the pudding: >> >> In [1]: a = range(1) >> >> In [2]: s = set(a) >> >> In [3]: s2 = set(a) >&g

Re: Performance of list vs. set equality operations

2010-04-06 Thread Chris Colbert
the proof is in the pudding: In [1]: a = range(1) In [2]: s = set(a) In [3]: s2 = set(a) In [5]: b = range(1) In [6]: a == b Out[6]: True In [7]: s == s2 Out[7]: True In [8]: %timeit a == b 1000 loops, best of 3: 204 us per loop In [9]: %timeit s == s2 1 loops, best of 3: 124 us

Re: I'm not sure you understand

2010-04-02 Thread Chris Colbert
On Fri, Apr 2, 2010 at 11:35 AM, A Serious Moment wrote: > Do you really not see the complete absurdity of posting an entire paper in this forum as plain text? Not only are you completely off-topic for this group, but the paper as you posted it is completely unreadable; regardless of whether i

Re: Python + OpenOffice Calc

2010-03-31 Thread Chris Colbert
On Wed, Mar 31, 2010 at 4:21 PM, bobicanprogram wrote: > On Mar 31, 2:47 am, Tracubik wrote: > > Hi all! > > i'm giving away to a friend of mine that have a garage (he repair car) my > > old computer. He will use it essentialy to create estimates of the work > > via an ods file (i've made a simp

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 9:59 PM, Chris Colbert wrote: > > > On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote: > >> I have two arrays, made with numpy. The first one has values that I want >> to use as sorting keys; the second one needs to be sorted by those keys. &

Re: sort array, apply rearrangement to second

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 7:25 PM, Victor Eijkhout wrote: > I have two arrays, made with numpy. The first one has values that I want > to use as sorting keys; the second one needs to be sorted by those keys. > Obviously I could turn them into a dictionary of pairs and sort by the > first member, bu

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Chris Colbert
On Tue, Mar 30, 2010 at 1:08 PM, John Nagle wrote: > Chris Rebert wrote: > >> On Tue, Mar 30, 2010 at 8:40 AM, gentlestone >> wrote: >> >>> Hi, how can I write the popular C/JAVA syntax in Python? >>> >>> Java example: >>> return (a==b) ? 'Yes' : 'No' >>> >>> My first idea is: >>> return ('N

Re: "Usability, the Soul of Python"

2010-03-30 Thread Chris Colbert
not really, the int will eventually overflow and cycle around ;) On Tue, Mar 30, 2010 at 8:11 AM, Xavier Ho wrote: > Did no one notice that > > > for(i = 99; i > 0; ++i) > > Gives you an infinite loop (sort of) because i starts a 99, and increases > every loop? > > Cheers, > > Ching-Yun Xavier H

Re: GIF89A and PIL

2010-03-27 Thread Chris Colbert
since the images only use a couple colors each, just run length encode it. Depending on the image, you may be able to get a super small size that way, and avoid the whole mess. On Sat, Mar 27, 2010 at 11:32 PM, Harishankar wrote: > On Sat, 27 Mar 2010 19:44:54 -0700, Stephen Hansen wrote: > > > O

Re: Have you embraced Python 3.x yet?

2010-03-26 Thread Chris Colbert
On Fri, Mar 26, 2010 at 4:07 PM, Mensanator wrote: > On Mar 26, 8:23 am, Harishankar wrote: > > Have you people embraced Python 3.x or still with 2.5 or 2.6? > > 3.1. > > The only module I use regularly is gmpy and that's one that has > been updated. > -- > http://mail.python.org/mailman/listinf

Re: Classes as namespaces?

2010-03-26 Thread Chris Colbert
i use them in Pymazon to encapsulate program wide settings and enforce valid values for these settings. http://code.google.com/p/pymazon/source/browse/pymazon/settings.py On Fri, Mar 26, 2010 at 11:50 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > kj wrote: > >> What's the word on

Re: nested threading

2010-03-25 Thread Chris Colbert
Spawning a thread from within a thread works just fine. Calling thread.start() is a non-blocking function and returns immediately. On Thu, Mar 25, 2010 at 11:23 AM, Omer Ihsan wrote: > is there anything as "nested threading"that is, call a thread from > within a thread. > in this case how wi

ANN: Pymazon 0.1.1 Released

2010-03-25 Thread Chris Colbert
I'm happy to announce the release of Pymazon 0.1.1! This release brings a big enhancement in the form of PyGtk support in addition to the PyQt4 and Command line interfaces already available. A special thanks to Ray Meyers for his gtk commits! Pymazon Changelog 0.1.1 - - Added support for com

Re: C++ code generation

2010-03-18 Thread Chris Colbert
I think Stefan was telling you, in a nice way, to stop spamming every thread about code generation with a plug for your project. 2010/3/17 CHEN Guang > >> - Original Message - > >> From: "Dan Goodman" > >> > >>> I'm doing some C++ code generation using Python, and would be > interested >

Re: Possible to open a file for shared write mode under Windows?

2010-03-17 Thread Chris Colbert
I am subprocess I am main process. I am subprocess I am main process. I am subprocess I am main process. I am subprocess I am main process. I am subprocess I am main process. On Thu, Mar 18, 2010 at 12:52 AM, Steve Holden wrote: > Chris Colbert wrote: > [top-posting switched to bott

Re: Possible to open a file for shared write mode under Windows?

2010-03-17 Thread Chris Colbert
you could also just have one process do the writing for both processes via pipes. On Thu, Mar 18, 2010 at 12:20 AM, Gabriel Genellina wrote: > En Wed, 17 Mar 2010 23:42:46 -0300, escribió: > > > Is there a way to open a file for shared write mode under >> Windows? >> >> I have 2 processes that

Re: execute bash builtins in python

2010-03-17 Thread Chris Colbert
On Wed, Mar 17, 2010 at 11:44 AM, Nobody wrote: > On Fri, 12 Mar 2010 08:15:49 -0500, Steve Holden wrote: > > > For shell=True I believe you should provide the command as a single > > string, not a list of arguments. > > Using shell=True with an argument list is valid. > > On Unix, it's seldom wh

Re: loop over list and process into groups

2010-03-04 Thread Chris Colbert
Man, deja-vu, I could have sworn I read this thread months ago... On Thu, Mar 4, 2010 at 2:18 PM, nn wrote: > > > lbolla wrote: > > On Mar 4, 3:57 pm, Sneaky Wombat wrote: > > > [ {'vlan_or_intf': 'VLAN2021'}, > > > {'vlan_or_intf': 'Interface'}, > > > {'vlan_or_intf': 'Po1'}, > > > {'vlan_o

Re: Spam from gmail (Was: fascism)

2010-02-23 Thread Chris Colbert
this image is appropriate: http://4.bp.blogspot.com/_pS7sKjlzwFg/SwhG1S901pI/Eiw/XSm93RIY2WE/s400/kelso-burn.jpg On Tue, Feb 23, 2010 at 6:06 PM, Daniel Fetchinson < fetchin...@googlemail.com> wrote: > >> >> Is it just me or has the spew from gmail on this list radically > >> >> increase

Re: Re: DreamPie - The Python shell you've always dreamed about!

2010-02-23 Thread Chris Colbert
Do you have gtk and PyGTK installed? Sounds like a missing dependency to me. On Tue, Feb 23, 2010 at 6:56 AM, Alan Harris-Reid < aharrisr...@googlemail.com> wrote: > gorauskas wrote: > >> I installed it on a Windows 7 machine with CPython 2.6.4 and I get the >> following error: >> >> Traceback (m

Re: formatting a number as percentage

2010-02-21 Thread Chris Colbert
>>> print('%.0f%%' % (0.7*100)) 70% On Sun, Feb 21, 2010 at 12:53 PM, vsoler wrote: > I'm trying to print .7 as 70% > I've tried: > > print format(.7,'%%') > .7.format('%%') > > but neither works. I don't know what the syntax is... > > Can you help? > > Thank you > -- > http://mail.python.org/ma

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
This is bloody fantastic! I must say, this fixes everything I hate about Ipython and gives me the feature I wished it had (with a few minor exceptions). I confirm this working on Kubuntu 9.10 using the ppa listed on the sites download page. I also confirm that it works interactively with PyQt4 an

Re: DreamPie - The Python shell you've always dreamed about!

2010-02-21 Thread Chris Colbert
http://dreampie.sourceforge.net/download.html reading is a wonderful thing. On Sun, Feb 21, 2010 at 11:32 AM, Mensanator wrote: > On Feb 21, 10:30�am, Mensanator wrote: > > On Feb 21, 3:42 am, Noam Yorav-Raphael wrote:> I'm > pleased to announce DreamPie 1.0 - a new graphical interactive > >

Re: Avoid converting functions to methods in a class

2010-02-19 Thread Chris Colbert
this is somewhat hackish: In [1]: def test(): ...: print 'spam' ...: ...: In [20]: class Ham(): : target = {'target': test} : def test_eggs(self): : self.target['target']() : : In [21]: h = Ham() In [22]: h.test_eggs() spam On Fr

Re: What happened to pyjamas?

2010-02-18 Thread Chris Colbert
gt; > > On Feb 18, 2010, at 1:44 PM, Chris Colbert wrote: > > > > > -- http://mail.python.org/mailman/listinfo/python-list

Re: What happened to pyjamas?

2010-02-18 Thread Chris Colbert
it's working for me. On Thu, Feb 18, 2010 at 1:16 PM, Daniel Fetchinson < fetchin...@googlemail.com> wrote: > Does anyone know what happened to pyjs.org ? > > Cheers, > Daniel > > > -- > Psss, psss, put it down! - http://www.cafepress.com/putitdown > -- > http://mail.python.org/mailman/listinfo/p

Re: How to use AWS/PAA nowadays? PyAWS / pyamazon outdated?

2010-02-18 Thread Chris Colbert
This one works for the product API. http://pypi.python.org/pypi/python-amazon-product-api/0.2.1 On Thu, Feb 18, 2010 at 5:09 AM, Snaky Love wrote: > Hi, > > is anybody aware of any updated and / or maintained library for > accessing AWS/PAA with Python? I found the dusty pyamazon and a > derivat

Re: working with laptop battery

2010-02-13 Thread Chris Colbert
You'll need acpi installed: In [6]: import subprocess In [7]: p = subprocess.Popen('acpi', stdout=subprocess.PIPE) In [8]: output, errors = p.communicate() In [9]: print output --> print(output) Battery 0: Full, 100%, rate information unavailable On Sat, Feb 13, 2010 at 8:43 PM, Daniel D

Re: fork vs threading.Thread

2010-02-12 Thread Chris Colbert
dont call the .run() method, call the .start() method which is defined the Thread class (and should NOT be overridden). tftpserv.start() xmlserv.start() On Fri, Feb 12, 2010 at 10:57 PM, Jordan Apgar wrote: > I'm trying to run two servers in the same program at once. Here are > the two: > cl

Re: ANN: obfuscate

2010-02-08 Thread Chris Colbert
I always though a double rot13 followed by a rot26 was the best? On Mon, Feb 8, 2010 at 9:19 PM, Tim Chase wrote: > Steven D'Aprano wrote: > >> obfuscate is a pure-Python module providing classical encryption >> algorithms suitable for obfuscating and unobfuscating text. >> >> obfuscate includes

Re: Read PGM's with more than 256 range in PIL1.1.7

2010-02-08 Thread Chris Colbert
According the pil manual it handles PGM files with "'1', 'L', or 'RGB' data" which leads me to believe 16bit data is not supported. You CAN write your own decoder for that though: http://www.pythonware.com/library/pil/handbook/decoder.htm It would be trivial to write a decoder for the pgm format.

determining which value is the first to appear five times in a list?

2010-02-06 Thread Chris Colbert
I'm working on a naive K-nearest-neighbors selection criteria for an optical character recognition problem. After I build my training set, I test each new image against against the trained feature vectors and record the scores as follows: match_vals = [(match_val_1, identifier_a), (match_val_2, i

Re: How to guard against bugs like this one?

2010-02-01 Thread Chris Colbert
This is kinda akin to creating your own libc.so in a folder where your compiling and executing c programs and then wondering why your program bugs out On Mon, Feb 1, 2010 at 9:34 PM, kj wrote: > > > I just spent about 1-1/2 hours tracking down a bug. > > An innocuous little script, let's cal

Re: For loop searching takes too long!

2010-01-28 Thread Chris Colbert
if you're open to other libraries, this could be done extremely fast in numpy. On my machine summing that whole array takes 75ms. On Thu, Jan 28, 2010 at 8:00 PM, Steven D'Aprano < st...@remove-this-cybersource.com.au> wrote: > On Thu, 28 Jan 2010 15:52:14 -0800, elsa wrote: > > > Now, what I ne

Re: Python, PIL and 16 bit per channel images

2010-01-25 Thread Chris Colbert
On Mon, Jan 25, 2010 at 5:04 PM, Peter Chant wrote: > Does anyone know whether PIL can handle 16 bit per channel RGB images? > PyPNG site (http://packages.python.org/pypng/ca.html) states PIL uses 8 > bits > per channel internally. > > Thanks, > > Pete > > > -- > http://www.petezilla.co.uk > > --

Re: list.pop(0) vs. collections.dequeue

2010-01-25 Thread Chris Colbert
On Mon, Jan 25, 2010 at 5:09 PM, Steve Howell wrote: > On Jan 25, 1:32 pm, Arnaud Delobelle wrote: > > Steve Howell writes: > > > > [...] > > > > > My algorithm does exactly N pops and roughly N list accesses, so I > > > would be going from N*N + N to N + N log N if switched to blist. > > > > C

Re: Mastering Python 3 I/O - Special Preview - Feb 5, 2010 (Chicago)

2010-01-22 Thread Chris Colbert
oops :) On Fri, Jan 22, 2010 at 9:41 PM, Steve Holden wrote: > Dave: > > New York classes went well this week, and there appears to be some > demand for Chicago training. How can we satisfy this demand to our > common profit? > > regards > Steve > > David Beazley wrote: > >

Re: html code generation

2010-01-20 Thread Chris Colbert
ah ok, i misread your post. Store each 'junk' as an item in the deque. the idea is the same though. On Wed, Jan 20, 2010 at 4:55 PM, Chris Colbert wrote: > > > On Wed, Jan 20, 2010 at 4:52 PM, Chris Colbert wrote: > >> use a deque with a 'junk' as eac

Re: html code generation

2010-01-20 Thread Chris Colbert
On Wed, Jan 20, 2010 at 4:52 PM, Chris Colbert wrote: > use a deque with a 'junk' as each element > > http://docs.python.org/library/collections.html > > On Wed, Jan 20, 2010 at 4:03 PM, George Trojan wrote: > >> I need an advice on table generatio

Re: html code generation

2010-01-20 Thread Chris Colbert
use a deque with a 'junk' as each element http://docs.python.org/library/collections.html On Wed, Jan 20, 2010 at 4:03 PM, George Trojan wrote: > I need an advice on table generation. The table is essentially a fifo, > containing about 200 rows. The rows are inserted every few minutes or so. > T

Re: Python IDE for MacOS-X

2010-01-19 Thread Chris Colbert
On Tue, Jan 19, 2010 at 2:09 AM, Jean Guillaume Pyraksos wrote: > What's the best one to use with beginners ? > Something with integrated syntax editor, browser of doc... > Thanks, > >JG > -- > http://mail.python.org/mailman/listinfo/python-list > I whole-heartedly recommend WingIDE. It's co

Re: PyQwt installation

2010-01-18 Thread Chris Colbert
On Mon, Jan 18, 2010 at 6:15 PM, Gib Bogle wrote: > Should there be a problem installing PyQwt5.2.0 with PyQt4.4.4 and > Python2.6 on Windows? My student is saying she can't get the Windows > installer to work, and she points out that the download site says "Binary > installation of PyQwt-5.2.0 o

Re: lightweight encryption of text file

2010-01-08 Thread Chris Colbert
PyCrypto is already pretty easy to use by itself. I dont know why you want a wrapper on top of it. On Fri, Jan 8, 2010 at 11:02 PM, Irmen de Jong wrote: > On 8-1-2010 22:39, Daniel Fetchinson wrote: > >> >>>http://www.nightsong.com/phr/crypto/p3.py >>> >> >> Thanks a lot, currently I'm having

Re: Dictionary used to build a Triple Store

2010-01-07 Thread S. Chris Colbert
> Definitely a newbie question, so please bear with me. > > I'm reading "Programming the Semantic Web" by Segaran, Evans, and Tayor. > > It's about the Semantic Web BUT it uses python to build a "toy" triple > store claimed to have good performance in the "tens of thousands" of > triples. > > J

ANN: Pymazon 0.1.0 released!

2010-01-07 Thread S. Chris Colbert
Hello, I'm happy to announce the first non-beta release of Pymazon: a python implemented downloader for the Amazon mp3 store. Improvements from the beta: - Running download status indicator - Various fixes for Windows - Some code cleanup Pymazon was created to be a simple and easy alternative

Re: how to change when the logging module creates the log file?

2010-01-06 Thread Chris Colbert
i was able to fix the exception by calling logging.shutdown() before the call to os.remove(). However, I still think there is probably a more elegant solution. On Wed, Jan 6, 2010 at 12:57 PM, Chris Colbert wrote: > I have an application the writes to a log file when specific exceptions

how to change when the logging module creates the log file?

2010-01-06 Thread Chris Colbert
I have an application the writes to a log file when specific exceptions are handled. However, if no exceptions are encountered, I don't want to create a log at all. The problem I am running into is that the stdlib logging module creates the log file immediately upon logger instantiation. Thus: >>

Re: ANN: Pymazon 0.1beta released.

2010-01-04 Thread Chris Colbert
On Mon, Jan 4, 2010 at 11:43 AM, Tim Wintle wrote: > On Tue, 2009-12-29 at 19:44 +0100, Chris Colbert wrote: > > I'm happy to announce the first beta release of Pymazon: a Python > > implemented alternative to the Amazon mp3 downloader. > > > > Pymazon was creat

ANN: Pymazon 0.1beta released.

2009-12-29 Thread Chris Colbert
I'm happy to announce the first beta release of Pymazon: a Python implemented alternative to the Amazon mp3 downloader. Pymazon was created specifically to alleviate the issues surrounding the Linux version of the Amazon mp3 downloader (though it should run just fine in Windows too). Pymazon can

doing cool stuff with Python and Industrial Robots....

2009-12-19 Thread Chris Colbert
Im just finishing up some research work during a stint as a visiting researcher in Germany. I've made a short clip showing a KUKA robot performing object reconstruction using a single camera mounted on the robot. The entire system is written in Python (control, math, everything) and related infra

a python downloader for the Amazon mp3 store

2009-12-19 Thread Chris Colbert
So, I wasn't happy with the Amazon mp3 downloader for linux (because it sucks). And clamz is written in C with a bunch of dependencies. Thus, I've created a python downloader for .amz files using the crypto keys figured out by Ben Moody (clamz author). Its just command line only right now, but I

Re: relative imports with the __import__ function

2009-12-09 Thread Chris Colbert
On Tue, Dec 8, 2009 at 5:48 PM, Peter Otten <__pete...@web.de> wrote: > Chris Colbert wrote: > >> I have package tree that looks like this: >> >> main.py >> package >> __init__.py >> configuration.ini >> server >> __in

relative imports with the __import__ function

2009-12-08 Thread Chris Colbert
I have package tree that looks like this: main.py package __init__.py configuration.ini server __init__.py xmlrpc_server.py controller.py reco segmentation __init__.py red_objects.py main.py launches an instance of

Re: why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
What a newbie mistake for me to make. I appreciate the replies everyone! Cheers, Chris > On Fri, 27 Nov 2009 17:06:44 +0100, S. Chris Colbert wrote: > > I would think that second loop should terminate at 9.9, no? > > > > I am missing something fundamental? > > &qu

why do I get this behavior from a while loop?

2009-11-27 Thread S. Chris Colbert
This seems strange to me, but perhaps I am just missing something: In [12]: t = 0. In [13]: time = 10. In [14]: while t < time: : print t : t += 1. : : 0.0 1.0 2.0

Re: calling server side function

2009-10-28 Thread Chris Colbert
I second the suggestion for XML-RPC... It also solves the security issue in your example, by only exporting functions you specifically register... look at xmlrpclib in the standard python library. On Wed, Oct 28, 2009 at 8:59 AM, Gabriel Genellina wrote: > En Wed, 28 Oct 2009 04:04:50 -0300, Pa

Re: IDLE python shell freezes after running show() of matplotlib

2009-10-28 Thread Chris Colbert
This is a threading issue that is very common when using gui toolkits with the interactive interpreter. You're better off just using ipython, which already has builtin support for matplotlib when you start it via "ipython -pylab" On Wed, Oct 28, 2009 at 7:41 PM, OKB (not okblacke) wrote: > For

Re: What IDE has good git and python support?

2009-10-27 Thread Chris Colbert
it depends on what i'm doing. quick and dirty test script: ipython a larger problem with code I am likely to use later: spyder a multi-module large project (like wrapping opencv): Wing Chris On Tue, Oct 27, 2009 at 5:04 PM, Mick Krippendorf wrote: > Aweks schrieb: >> what do you use? > > Eith

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
My emails must not be making it to list... I posted a solutions about 10 minutes after I posted the questions. Thanks! On Tue, Oct 13, 2009 at 12:35 PM, Dave Angel wrote: > Chris Colbert wrote: >> >> Say I use python to talk to a wireless webcamera that delivers images >&

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Heh, for whatever reason, your post is dated earlier than my response, but wasn't here when I sent mine. But yeah, PIL worked. On Tue, Oct 13, 2009 at 12:04 PM, Stefan Behnel wrote: > Chris Colbert wrote: >> Say I use python to talk to a wireless webcamera that delivers imag

Re: does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
: numpyimg.shape Out[14]: (768, 1024, 3) In [15]: numpyimg.dtype Out[15]: dtype('uint8') On Tue, Oct 13, 2009 at 11:51 AM, Chris Colbert wrote: > Say I use python to talk to a wireless webcamera that delivers images > via http requests. > > I request an image and read it i

does anyone know how to use libjeg from within memory in python

2009-10-13 Thread Chris Colbert
Say I use python to talk to a wireless webcamera that delivers images via http requests. I request an image and read it into a buffer, but the image is in jpeg format. I would like to convert this to a simple RGB format buffer to pass to numpy. Has anyone managed this using libjpeg or any other l

Re: how to use WSGI applications with apache

2009-10-07 Thread Chris Colbert
if you want to use it with apapache, you need mod_wsgi. If you want a pure python solution, you can use the wsgi server that comes with CherryPy. Personally, I use the wsgi server in CherrPy on my website. My site is not large by any means and the ease of deployment completely erased any benefit

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
that's a good idea. Thanks! On Mon, Oct 5, 2009 at 4:18 PM, MRAB wrote: > Chris Colbert wrote: >> >> because when i import this module, the classes will already be >> determined by the intitial flag setting. >> >> i.e. >> SIMULATION = False >>

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I suppose i can just move the SIMULATION flag to another module, and then import it and check it before intstantiation. So, the arg parser will have to set the flag before any other processing begins... On Mon, Oct 5, 2009 at 3:49 PM, Chris Colbert wrote: > I dont think so, because that wo

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
, and the controller takes care of it... On Mon, Oct 5, 2009 at 3:44 PM, Richard Brodie wrote: > > "Chris Colbert" wrote in message > news:mailman.868.1254748945.2807.python-l...@python.org... > >> I am trying to abstract this machinery in a single class called >>

Re: Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
ON = True In [7]: c = testcontroller.Controller() In [8]: c.foo() baz On Mon, Oct 5, 2009 at 3:32 PM, MRAB wrote: > Chris Colbert wrote: >> >> I have an application that needs to run different depending on whether >> the input data is being simulated, or provided from instrumentation. >

Is there a way to specify a superclass at runtime?

2009-10-05 Thread Chris Colbert
I have an application that needs to run different depending on whether the input data is being simulated, or provided from instrumentation. I am trying to abstract this machinery in a single class called Controller which I want to inherit from either SimController or RealController based on whethe

Re: Python shared lib

2009-10-04 Thread Chris Colbert
thats because the standard way to build python packaged is to use distutils, and not make files. Blame Yafaray for not supplying a setup.py... ..M, Aahz wrote: > In article , > namekuseijin   wrote: >> >>and then I realize that, for whatever reason, the super popular and >>trendy python DOESN'T

Re: easy question, how to double a variable

2009-10-02 Thread Chris Colbert
I come from a scientific background, so my approach to the solution of this problem is a little different. It makes use of some numerical approximations, but that's not necessarily a bad thing, because it helps avoid singularities. So it could be a little more robust than other solutions presented

Re: Looking for a pure Python chart drawing module

2009-09-17 Thread Chris Colbert
by your definitions, Python is just a wrapper around a C library. If none of the solutions work for you, roll your own. On Thu, Sep 17, 2009 at 11:38 AM, Giacomo Boffi wrote: > John Nagle writes: > >> gerlos wrote: >>> John Nagle ha scritto: >>> I'm looking for something that can draw simp

Re: unpacking vars from list of tuples

2009-09-17 Thread Chris Colbert
if you have numpy installed: ln[12]: import numpy as np In [13]: k = np.array([('a', 'bob', 'c'), ('p', 'joe', 'd'), ('x', 'mary', 'z')]) In [14]: k Out[14]: array([['a', 'bob', 'c'], ['p', 'joe', 'd'], ['x', 'mary', 'z']], dtype='|S4') In [15]: k[:,1] Out[15]: array(['bob',

Re: Why use "locals()"

2009-09-13 Thread Chris Colbert
Given that python is devoid of types: "Is the variable 'a' an int or a float at runtime?", explicit can only be taken so far. Personally, I use locals() when I work with Django. On Mon, Sep 14, 2009 at 7:42 AM, Sean DiZazzo wrote: >> If you are willing to open your mind to the possibility that

Re: Accessing objects at runtime.

2009-09-13 Thread Chris Colbert
why not just pawn your processing loop off onto a child thread and give yourself a hook (function) that you can call that return whatver info you what. Run the script in ipython, problem solved. On Mon, Sep 14, 2009 at 7:57 AM, jacopo wrote: > >>    You might consider running a BaseHTTPServer in

Re: IDE for Python

2009-08-31 Thread Chris Colbert
I'm a big fan of wing. Pay for the non-free version and you get all the goodies, plus PHENOMENAL support. Really. They answer support emails within a few minutes. Its has the best code completion i've seen in any python editor/ide and is also the most stable, fastest (for ide's), and customizable.

Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
Great! That was the solution I was looking for. Thanks! Chris On Sun, Aug 30, 2009 at 12:29 PM, Christian Heimes wrote: > Chris Colbert wrote: >> Is there a way to fix this so that the local dist-packages is added to >> sys.path before the system directory ALWAYS? I can do

Re: Permanently adding to the Python path in Ubuntu

2009-08-30 Thread Chris Colbert
P.S. my first name is Steven! Cheers, Chris On Sat, Aug 29, 2009 at 11:51 PM, Sean DiZazzo wrote: > On Aug 29, 5:39 pm, Chris Colbert wrote: >> I'm having an issue with sys.path on Ubuntu. I want some of my home >> built packages to overshadow the system packages. Namely, I ha

Permanently adding to the Python path in Ubuntu

2009-08-29 Thread Chris Colbert
I'm having an issue with sys.path on Ubuntu. I want some of my home built packages to overshadow the system packages. Namely, I have built numpy 1.3.0 from source with atlas support, and I need it to overshadow the system numpy 1.2.1 which I had to drag along as a dependency for other stuff. I have