Implementing chain of responsibility

2009-03-08 Thread koranthala
Hi, I want to implement chain of responsibility pattern in Python (for a Django project) The problem that I see is a rather odd one - how to link the subclasses with the super class. Ex: Suppose the two child classes are as given below (A1, A2 child classes of A) class A: ... class A1(

Re: 2.6.1 - simple division

2009-03-08 Thread Lie Ryan
Duncan Booth wrote: farsi...@gmail.com wrote: Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. Try to remember though that the decimal module simp

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: Just create an empty one. Won't quite work: merge tries to find full_current_version which is determined (if None) in msi.py from the rather involved current version stuff. Only if you don't pass an msi file on the command line. So I recommend that you do that. OK.

Re: str.Template 4 times slower than calling replace multiple times

2009-03-08 Thread Chris Rebert
On Sun, Mar 8, 2009 at 10:23 PM, John Machin wrote: > On Mar 9, 3:15 pm, Jack Steven wrote: >> Isn't string.Template suppose to be faster than calling replace multiple >> times? That's what I thought until I benchmarked this code, where >> string.Template ended up being 4 times slower. >> >> This

Re: str.Template 4 times slower than calling replace multiple times

2009-03-08 Thread John Machin
On Mar 9, 3:15 pm, Jack Steven wrote: > Isn't string.Template suppose to be faster than calling replace multiple > times? That's what I thought until I benchmarked this code, where > string.Template ended up being 4 times slower. > > This doesn't make sense to me, since unlike when you are calling

Re: A Dangling Tk Entry

2009-03-08 Thread W. eWatson
r wrote: On Mar 8, 9:34 pm, "W. eWatson" wrote: Radiboutton(master, textvariable = ... Radiobutton(msster, textvariable = ... Checkbox(master, text=... entry = Entry(master, width=10, ... entry.insert(0,self.slowdown)# testing a default methodology Label( master, text="Max... Entry(master,

Re: NEWB: dividing numbers

2009-03-08 Thread jitendra gupta
try any one 1) >>>from __future__ import division >>>2/3 -1/3 0.1 2) >>>x = 2/3.0 >>>x - 1/3.0 0.1 On Mon, Mar 9, 2009 at 9:33 AM, Daniel Dalton wrote: > Hi, > > On Mon, Mar 09, 2009 at 12:08:16AM +0100, Lo wrote: > > I just tried python first time. > > > > 2/3

Do python.org MacOS X dmg installers still only provide 32 bit Python framework?

2009-03-08 Thread Graham Dumpleton
I'd rather not have to download and install them as I don't want to be installing them into my actual system, so can someone please tell me whether the MacOS X dmg installers provided from www.python.org are still not full universal builds. That is, that the Python framework component only contains

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 12:31 pm, Dennis Lee Bieber wrote: > On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits > declaimed the following in gmane.comp.python.general: > > > > > > > For those of you who asked about the SQL the full function is here. > > The connection is to a sqlite database with the row_factory

str.Template 4 times slower than calling replace multiple times

2009-03-08 Thread Jack Steven
Isn't string.Template suppose to be faster than calling replace multiple times? That's what I thought until I benchmarked this code, where string.Template ended up being 4 times slower. This doesn't make sense to me, since unlike when you are calling replace multiple times, code behind Template ca

Re: Ban Xah Lee

2009-03-08 Thread Tim Greer
Steve Sobol wrote: > > On 2009-03-09, Kenneth Tilton wrote: > >> Buddha taught that the universe is ineluctably a single >> interconnected web of cause and effect, which is my haughty preamble >> to this observation: it depends on the newsgroup. >> >> comp.lang.lisp is cool so here Xah particip

Re: NEWB: dividing numbers

2009-03-08 Thread Daniel Dalton
Hi, On Mon, Mar 09, 2009 at 12:08:16AM +0100, Lo wrote: > I just tried python first time. > > 2/3 > > the result is zero That's because your dividing an int by an int to an int. The definition of an int is a "whole number". So just use floating point I think it's called, this should work, and d

Re: help with printing to stdout...

2009-03-08 Thread Daniel Dalton
> or like this: > > print '\r'+str(percent), > > Then make sure it gets sent out, like this: > > sys.stdout.flush() Hey! Thanks very much, that did the trick! Thanks to everyone that replied, I discovered converting to str was crutial to actually print anything. :) Cheers, Daniel. -- http:/

Re: This should be a simple question...

2009-03-08 Thread Steve Holden
Steven D'Aprano wrote: > Steve Holden wrote: > >> If x and b are meant to be global than bite the bullet and *make* them >> global. > > Well, there's global, and there's global. > > There's global to a few functions in a module, there's global to everything > in a module, and global to an entire

Re: Reading from text

2009-03-08 Thread Steve Holden
Aahz wrote: > In article , > Tim Chase wrote: >>> Assuming this is a real task and not a homework problem, then >>> I'd do it this way: >>> >>> $ cd [directory containing 50 test files] >>> $ (for file in *; do head -n11 $file | tail -n5; done) >>> >/path/to/results-file.txt >> I'd use sed:

Re: wxPython fast and slow

2009-03-08 Thread Carl Banks
On Mar 8, 12:35 pm, iu2 wrote: > On Mar 8, 1:42 pm, Carl Banks wrote: > > > > > On Mar 8, 1:52 am, iu2 wrote: > > > > On Mar 6, 6:52 pm, Mike Driscoll wrote: > > > > > ... > > > > Can you post a sample application so we can try to figure out what's > > > > wrong? You might also cross-post this

Re: Candidate for a new itertool

2009-03-08 Thread jay logan
On Mar 7, 8:47 pm, Raymond Hettinger wrote: > The existing groupby() itertool works great when every element in a > group has the same key, but it is not so handy when groups are > determined by boundary conditions. > > For edge-triggered events, we need to convert a boundary-event > predicate to

Re: A Dangling Tk Entry

2009-03-08 Thread r
On Mar 8, 9:34 pm, "W. eWatson" wrote: > Radiboutton(master, textvariable = ... > Radiobutton(msster, textvariable = ... > Checkbox(master, text=... > entry = Entry(master, width=10, ... > entry.insert(0,self.slowdown)    # testing a default methodology > Label( master, text="Max... > Entry(maste

set_process_affinity_mask problem - Python 2.5 gcc 4.3.2 (Ubuntu 4.3.2-1ubuntu12)

2009-03-08 Thread Isaac Gouy
For a couple of months, I've been successfully using the Python set_process_affinity_mask wrapper from http://pypi.python.org/pypi/affinity/0.1.0 Now I've upgraded from Ubuntu 8.04 to Ubuntu 8.10 (from gcc 4.2.3 to gcc 4.3.2) and set_process_affinity_mask seems to fail on the x86 Ubuntu inst

A Dangling Tk Entry

2009-03-08 Thread W. eWatson
I'm looking at some Tk code written by someone else, and am curious about a methodology in the code. A setup object called SetDlg contains to code to set up parameters for some widgets for a dialog of radio buttons, checkboxes, and text/string entries. It then calls ShowDlg. After it returns in

Re: wxPython fast and slow

2009-03-08 Thread David Bolen
iu2 writes: > Indeed, but I don't think the CallAfter is necessary. I could just as > well remove the time.sleep in the original code. I could also make a > tight loop to replace time.sleep > for i in range(100): pass > and tune it to fit the speed I need. Except that CallAfter passed contro

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 11:31 am, Dennis Lee Bieber wrote: > On Sat, 7 Mar 2009 23:07:55 -0800 (PST), odeits > declaimed the following in gmane.comp.python.general: > > > > > > > For those of you who asked about the SQL the full function is here. > > The connection is to a sqlite database with the row_factory

Re: last and final attempt to search for python ods library.

2009-03-08 Thread Terry Reedy
JanC wrote: Krishnakant wrote: This is my last attempt to search for a nice python library for creating open document spreadsheet. I tryed python-ooolib but did not find a few features like merging cells (may be I am missing out some thing stupid ). You could add that feature to python-oooli

Re: python code to fortran 77's

2009-03-08 Thread John Machin
On Mar 9, 12:09 pm, Larry wrote: > Friends, > > I need to read a binary file using a Fortran 77 code to integrate with > a legacy code It looked very much complicated to me for I have no > knowledge in Fortran. > > I could read the file with ease using Python, as shown in the > following. > >

Re: Eclipse And PyDev

2009-03-08 Thread Steve Phillips
I will do that. I want to tinker with it just a little bit more to make sure I am not missing anything first. Thanks again. Steve On 3/8/09, Fabio Zadrozny wrote: > > > Thanks. I noticed that when I was on my windows box at work and I > > would check it and click apply then ok and when I go bac

Re: can't print the exception cause/context in Python3.0?

2009-03-08 Thread BigHand
On Mar 9, 9:02 am, BigHand wrote: > On Mar 8, 9:49 pm, "Gabriel Genellina" wrote: > > > > > En Sat, 07 Mar 2009 21:18:22 -0200, BigHand escribió: > > > > On 3月7日, 下午11时21分, "Gabriel Genellina"   > > > wrote: > > >> En Sat, 07 Mar 2009 11:46:08 -0200, BigHand   > > >> escribió: > > > >> > I wan

Re: retrieve traceback in embedded python of Python3.0?

2009-03-08 Thread BigHand
On Mar 7, 9:22 pm, "Gabriel Genellina" wrote: > En Sat, 07 Mar 2009 01:43:05 -0200, BigHand escribió: > > > > > On Mar 7, 11:40 am, BigHand wrote: > >> Guys: > >> I have a embedded python in MFC app. to execute a py script of a.py, > >> the is only one line in a.py, it "a()" , normally ,excute t

python code to fortran 77's

2009-03-08 Thread Larry
Friends, I need to read a binary file using a Fortran 77 code to integrate with a legacy code It looked very much complicated to me for I have no knowledge in Fortran. I could read the file with ease using Python, as shown in the following. ### from numpy import*

Re: can't print the exception cause/context in Python3.0?

2009-03-08 Thread BigHand
On Mar 8, 9:49 pm, "Gabriel Genellina" wrote: > En Sat, 07 Mar 2009 21:18:22 -0200, BigHand escribió: > > > On 3月7日, 下午11时21分, "Gabriel Genellina"   > > wrote: > >> En Sat, 07 Mar 2009 11:46:08 -0200, BigHand   > >> escribió: > > >> > I want the exception printted like this: > >> >   File "", l

Re: Ban Xah Lee

2009-03-08 Thread Roedy Green
On Sat, 7 Mar 2009 14:52:02 -0800 (PST), Xah Lee wrote, quoted or indirectly quoted someone who said : > >I consider this post relevant because i've been perennially gossiped >about in comp.lang.* groups today and in the past 5 or 10 years, many >of the threads mentioning my name are not started

Re: create boolean

2009-03-08 Thread Grant Edwards
On 2009-03-08, Rhodri James wrote: b = (n is not None) and (n != []) >>> >>> The second comparison isn't actually necessary, since an >>> empty list is True and a non-empty one False. >>> >>>b = (n is not None) and n >>> >>> Putting the comparison in does make the code slightly les

Re: wxPython fast and slow

2009-03-08 Thread iu2
On Mar 9, 12:44 am, Scott David Daniels wrote: > iu2 wrote: > > Here is the timer version. It works even more slowly, even with > > PyScripter active: ... > > > I actually tried this one first. Due to the slow speed I changed to > > looping inside the event. > > I don't understand why it takes so

Re: create boolean

2009-03-08 Thread Rhodri James
On Sat, 07 Mar 2009 05:03:08 -, Grant Edwards wrote: On 2009-03-07, Rhodri James wrote: On Fri, 06 Mar 2009 15:34:08 -, Grant Edwards wrote: On 2009-03-06, Fencer wrote: Hi, I need a boolean b to be true if the variable n is not None and not an empty list, otherwise b should b

Re: Guidance - Professional Python Development

2009-03-08 Thread Scott David Daniels
RT wrote: I have been doing Python development at work for several years. I started with the official documentation and tutorial, by necessity, the examples tend to be rather simple and none of them really explain the process of developing complete, industrial strength Python applications.

Re: NEWB: dividing numbers

2009-03-08 Thread MRAB
Lo wrote: I just tried python first time. 2/3 the result is zero I want the result to be .333... How do I get this? That's integer division (integer divided by integer is integer). If you want the result to be floating point then make one of them floating point: 2.0 / 3 or do this

Re: NEWB: dividing numbers

2009-03-08 Thread Michal Wyrebski
Lo pisze: I just tried python first time. 2/3 the result is zero Float type must be specified explicitly: 2/3.0 or 2.0/3 In Python 3.x operators behave differently and '2/3' would give float number as a result. I want the result to be .333... Than try: 1/3.0 because 2/3.0 will never

Re: NEWB: dividing numbers

2009-03-08 Thread Chris Rebert
On Sun, Mar 8, 2009 at 3:08 PM, Lo wrote: > I just tried python first time. > > 2/3 > > the result is zero > > I want the result to be .333... > > How do I get this? Add the following to the top of your program: from __future__ import division That tells Python to use the proper kind of divisio

Re: NEWB: dividing numbers

2009-03-08 Thread Grant Edwards
On 2009-03-08, Lo wrote: > I just tried python first time. > > 2/3 > > the result is zero > > I want the result to be .333... How odd. > How do I get this? 1./3 -- Grant -- http://mail.python.org/mailman/listinfo/python-list

Re: NEWB: dividing numbers

2009-03-08 Thread Diez B. Roggisch
Lo schrieb: I just tried python first time. 2/3 the result is zero I want the result to be .333... Well, that's not going to happen - 2/3 is .666 if not done with integers... How do I get this? Use floating points. >>> 2.0 / 3.0 0.3 Diez -- http://mail.python.org/mailma

NEWB: dividing numbers

2009-03-08 Thread Lo
I just tried python first time. 2/3 the result is zero I want the result to be .333... How do I get this? Thanks a lot L -- http://mail.python.org/mailman/listinfo/python-list

Re: How to extract some text?

2009-03-08 Thread Oltmans
On Mar 9, 3:37 am, Chris Rebert wrote: > Learn about the methods of the string class > (str):http://docs.python.org/library/stdtypes.html#id4 > > You'll probably be most interested in .split() OK, thanks I got it. I was trying to use Regex but .split() just worked like a charm. Thank you ;) > >

Re: factory functions & methods

2009-03-08 Thread andrew cooke
andrew cooke wrote: > above is with 3.0. for some odd reason i thing the order of teh args to > MethodType may have changed recently, so be careful. sorry, no, had 2.6 running there... andrew -- http://mail.python.org/mailman/listinfo/python-list

Re: factory functions & methods

2009-03-08 Thread andrew cooke
Aaron Brady wrote: > Hello, > > I am creating a container. I have some types which are built to be > members of the container. The members need to know which container > they are in, as they call methods on it, such as finding other > members. I want help with the syntax to create the members. >

Re: wxPython fast and slow

2009-03-08 Thread Scott David Daniels
iu2 wrote: Here is the timer version. It works even more slowly, even with PyScripter active: ... I actually tried this one first. Due to the slow speed I changed to looping inside the event. I don't understand why it takes so long to move that square with wx.Timer set to 1 ms interval. Perhaps

Re: How to extract some text?

2009-03-08 Thread Tim Pinkawa
On Sun, Mar 8, 2009 at 5:18 PM, Oltmans wrote: > I'm at a loss to figure out how to extract some text from a string. > Here is a string: > > setTimeout("location.href='http://youtube.example.com/login.aspx'", > 5000); > > and I want to only retrieve the URL from above i.e I only want this > http:/

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
>> Just create an empty one. > > Won't quite work: merge tries to find full_current_version > which is determined (if None) in msi.py from the rather > involved current version stuff. Only if you don't pass an msi file on the command line. So I recommend that you do that. > I'm going to give up

Re: How to extract some text?

2009-03-08 Thread Chris Rebert
On Sun, Mar 8, 2009 at 2:18 PM, Oltmans wrote: > I'm at a loss to figure out how to extract some text from a string. > Here is a string: > > setTimeout("location.href='http://youtube.example.com/login.aspx'", > 5000); > > and I want to only retrieve the URL from above i.e I only want this > http:/

How to extract some text?

2009-03-08 Thread Oltmans
I'm at a loss to figure out how to extract some text from a string. Here is a string: setTimeout("location.href='http://youtube.example.com/login.aspx'", 5000); and I want to only retrieve the URL from above i.e I only want this http://youtube.example.com/login.aspx from the above string. Any ide

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: merge.py attempts to import config.py but I can't find it... Just create an empty one. Won't quite work: merge tries to find full_current_version which is determined (if None) in msi.py from the rather involved current version stuff. I'm going to give up on this for to

factory functions & methods

2009-03-08 Thread Aaron Brady
Hello, I am creating a container. I have some types which are built to be members of the container. The members need to know which container they are in, as they call methods on it, such as finding other members. I want help with the syntax to create the members. Currently, the container has to

Re: last and final attempt to search for python ods library.

2009-03-08 Thread JanC
Krishnakant wrote: > This is my last attempt to search for a nice python library for creating > open document spreadsheet. > > I tryed python-ooolib but did not find a few features like merging cells > (may be I am missing out some thing stupid ). You could add that feature to python-ooolib. > I

Re: Parsing unicode (devanagari) text with xml.dom.minidom

2009-03-08 Thread rparimi
On Mar 8, 12:42 am, Stefan Behnel wrote: > rpar...@gmail.com wrote: > > I am trying to process an xml file that contains unicode characters > > (seehttp://vyakarnam.wordpress.com/). Wordpress allows exporting the > > entire content of the website into an xml file. Using > > xml.dom.minidom,  I wro

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
> First, it relies on config.py whose existence msi.py > optionally ignores. Feel free to create a patch for that. > File "", line 2, in OpenDatabase > pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, > None, None, 0, -2147024786), None) This is 0x8007006e; 0x6E, in turn, mi

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
> merge.py attempts to import config.py but I can't find it... Just create an empty one. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Ban Xah Lee

2009-03-08 Thread Boris Borcic
seconded. -- http://mail.python.org/mailman/listinfo/python-list

last and final attempt to search for python ods library.

2009-03-08 Thread Krishnakant
hello all, Sorry for the frustrated mail. This is my last attempt to search for a nice python library for creating open document spreadsheet. I tryed python-ooolib but did not find a few features like merging cells (may be I am missing out some thing stupid ). I have asked for some help before

Re: Themed TK (tk Tile) at last?!

2009-03-08 Thread Boris Borcic
Python Nutter wrote: Looks like we finally get tkinter GUI based programs according to Issue# 2983 in Python 3.1a so our programs don't look like something out of early 1980's Please don't confuse History gratuitously. Make that mid 90's. Cheers, BB -- http://mail.python.org/mailman/listinfo/

Re: Windows install to custom location after building from source

2009-03-08 Thread Gabriel Genellina
En Sun, 08 Mar 2009 18:08:50 -0200, Martin v. Löwis escribió: What does the merge do? I can't find mention of it in the docs. It merges the msvcrt merge module into the installer (and then monkey patches it, to revert the msm decision of setting ALLUSERS). I tried to integrate it originally

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: What does the merge do? I can't find mention of it in the docs. It merges the msvcrt merge module into the installer (and then monkey patches it, to revert the msm decision of setting ALLUSERS). I tried to integrate it originally as a step after creating the msi. Unfortun

Re: Ban Xah Lee

2009-03-08 Thread r
On Mar 8, 1:24 pm, Steven D'Aprano wrote: > r wrote: > > This is to all usenet readers who think they own c.l.py! > > [snip abusive, anti-social rant] > > Well, after kill-filing this kiddie for a few months, I thought I'd give him > a chance. By pure luck I chose this post to read. > > Good news

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
> What does the merge do? I can't find mention of it > in the docs. It merges the msvcrt merge module into the installer (and then monkey patches it, to revert the msm decision of setting ALLUSERS). I tried to integrate it originally as a step after creating the msi. Unfortunately, the merge objec

Re: Eclipse And PyDev

2009-03-08 Thread Fabio Zadrozny
> Thanks. I noticed that when I was on my windows box at work and I > would check it and click apply then ok and when I go back to those > prefs and it isn't checked. I did that a few times. I will try it on > my Linux box tomorrow at home and see if I have the same results. If it doesn't work fo

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Scott David Daniels wrote: Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. No; 2.7a0 is the version number of the svn HEAD.

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Martin v. Löwis wrote: In addition, the CVS version of pywin32 which I built in order to run the msi.py script has a small bug in genpy which prevents it from generating COM support in the way in which msi.py does it. I'm using Python 2.4 to run msi.py; that has always worked fine for me. Int

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
> Do you mean 3.1a0? As far as I know, 2.7a0 requires the use > of the time machine, as it is expected to be 3 months out. The current trunk calls itself 2.7a0. I think you might be referring to 3.0a1. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Windows install to custom location after building from source

2009-03-08 Thread Martin v. Löwis
> In addition, the CVS version of pywin32 which I built in > order to run the msi.py script has a small bug in genpy > which prevents it from generating COM support in the way > in which msi.py does it. I'm using Python 2.4 to run msi.py; that has always worked fine for me. Regards, Martin P.S.

Re: Windows install to custom location after building from source

2009-03-08 Thread Scott David Daniels
Tim Golden wrote: ... Anyhow, at the end I have a working Python 2.7a0 running under Windows. Do you mean 3.1a0? As far as I know, 2.7a0 requires the use of the time machine, as it is expected to be 3 months out. If you do get an installer built, even having a semi-official copy around for th

Re: Chandler, Python, speed

2009-03-08 Thread Ville M. Vainio
Ville M. Vainio wrote: > Alan G Isaac wrote: > >> 3. Chandler is not really an email client. So specifically, >> which of its functionalities is it slow, and what evidence >> if any is there that Python is causing this? > > I remember reading "somewhere" that the cause of slowness is/was > arch

Re: wxPython fast and slow

2009-03-08 Thread iu2
On Mar 8, 1:42 pm, Carl Banks wrote: > On Mar 8, 1:52 am, iu2 wrote: > > > > > On Mar 6, 6:52 pm, Mike Driscoll wrote: > > > > ... > > > Can you post a sample application so we can try to figure out what's > > > wrong? You might also cross-post this to thewxPythonmailing list. > > > They might k

Re: Chandler, Python, speed

2009-03-08 Thread Tim Wintle
On Sat, 2009-03-07 at 22:05 +, Ville M. Vainio wrote: > Alan G Isaac wrote: > > > 3. Chandler is not really an email client. So specifically, > > which of its functionalities is it slow, and what evidence > > if any is there that Python is causing this? > > I remember reading "somewhere" tha

Re: Sharing objects between processes

2009-03-08 Thread Aaron Brady
On Mar 8, 1:36 pm, ET wrote: > I have been using the 'threading' library and decided to try swapping it > out for 'processing'... while it's awesome that processing so closely > mirrors the threading interface, I've been having trouble getting my > processes to share an object in a similar way. >

Re: Sharing objects between processes

2009-03-08 Thread Tim Golden
ET wrote: Using the 'with' keyword didn't work... Just an aside here for any multiprocessing maintainers watching ;) . I expect that the "didn't work" here refers to this bug: http://bugs.python.org/issue5261 Altho' if the OP cares to clarify, it might be something else. TJG -- http://mail.

Sharing objects between processes

2009-03-08 Thread ET
I have been using the 'threading' library and decided to try swapping it out for 'processing'... while it's awesome that processing so closely mirrors the threading interface, I've been having trouble getting my processes to share an object in a similar way. Using the 'with' keyword didn't work, a

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Tim Golden wrote: Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice.

Re: Set & Frozenset?

2009-03-08 Thread Tim Golden
Diez B. Roggisch wrote: Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by k

Re: Ban Xah Lee

2009-03-08 Thread Steven D'Aprano
r wrote: > This is to all usenet readers who think they own c.l.py! [snip abusive, anti-social rant] Well, after kill-filing this kiddie for a few months, I thought I'd give him a chance. By pure luck I chose this post to read. Good news "r", you've earned yourself a permanent kill-filing. I'll

Re: where is the PyString_AsString in Python 3.0?

2009-03-08 Thread Stefan Behnel
BigHand wrote: > Finally I got the results now. This did take me 10 hours to solve > this. the docs of 3.0.. You will have to get used to Unicode. The code you used against the C-API mimics almost exactly the steps you'd use at the Python level. Stefan -- http://mail.python.org/mailman/listin

Re: where is the PyString_AsString in Python 3.0?

2009-03-08 Thread Stefan Behnel
BigHand wrote: > I know that there is no PyString_AsString in Python3.0, > could you guys give me instruction about how can I do with the > following ? > > PyObject *exc_type = NULL, *exc_value = NULL, *exc_tb = NULL; > PyErr_Fetch(&exc_type, &exc_value, &exc_tb); > > how do I transfer the exc_ty

Re: Set & Frozenset?

2009-03-08 Thread Diez B. Roggisch
Hans Larsen schrieb: Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by key. But

Re: Help cleaning up some code

2009-03-08 Thread odeits
On Mar 8, 4:48 am, "andrew cooke" wrote: > odeits wrote: > > On Mar 7, 1:07 pm, Scott David Daniels wrote: > >> odeits wrote: > >> > I am looking to clean up this code... any help is much appreciated. > >> > Note: It works just fine, I just think it could be done cleaner. > > >> > The result is a

Re: RELEASED Python 3.1 alpha 1

2009-03-08 Thread laplacia...@gmail.com
On Mar 7, 6:59 pm, Carl Banks wrote: > > I see that Brett Canon's importlib has finally made it into Python > standard library.  Congrats there (if you still read this list), I am > struggling with Python's arcane import semantics (for something > ridiculously silly) now and I feel your pain. > H

Set & Frozenset?

2009-03-08 Thread Hans Larsen
Could you help me ? How could I "take" an elemment from a set or a frozenset .-) ? From a string (unicode? Python<3), or from a tuple,or from a list: Element by index or slice. From a dict: by key. But what concerning a set o

Re: Windows install to custom location after building from source

2009-03-08 Thread Tim Golden
Gabriel Genellina wrote: En Fri, 06 Mar 2009 06:52:00 -0200, escribió: I have succeeded in building Python 2.6.1 from source under Windows XP by running Visual C++ 2008 Express on the PCbuild/pcbuild.sln file both from the Visual C++ application as well as from the commandline [...] I would li

Re: "/a" is not "/a" ?

2009-03-08 Thread Mark Dickinson
On Mar 7, 2:14 pm, Christian Heimes wrote: > Steven D'Aprano wrote: > > Yes. Floating point NANs are required to compare unequal to all floats, > > including themselves. It's part of the IEEE standard. > > As far as I remember that's not correct. It's just the way C has > interpreted the standard

Re: Ban Xah Lee

2009-03-08 Thread r
On Mar 7, 5:52 pm, Xah Lee wrote: > HARASSMENT BY JOHN BOKMA > > I was harassed by a newsgroup poster John Bokma (a regular of > comp.lang.perl.misc) to have my web hosting service provider kick me > off. This happened in 2006. I know the feeling. I have this super geek with nothing but time on

Re: Ban Xah Lee

2009-03-08 Thread r
On Mar 8, 7:50 am, "D'Arcy J.M. Cain" wrote: > So you are going to repeat his postings in their entirety so that those > that block him will see them anyway, right?  Wrong.  We'll just block > your posts too. > > *plonk* This is to all usenet readers who think they own c.l.py!

Re: RELEASED Python 3.1 alpha 1

2009-03-08 Thread Benjamin Peterson
Colin J. Williams ncf.ca> writes: > Do you have any schedule for a Windows > binary release? They should materialize on Monday. -- http://mail.python.org/mailman/listinfo/python-list

Re: Which Lisp to Learn?

2009-03-08 Thread Arne Vajhøj
Xah Lee wrote: For those of you imperative programers who kept on hearing about lisp and is tempted to learn, then, ... You: * consider yourself unfairly treated by various communities * post a long drivel about various Lisp flavors to newsgroups that are not in any way Lisp related ? There

Re: 2.6.1 - simple division

2009-03-08 Thread farsight
Thanks duncan, thats very helpful. I'll be more careful with floating point numbers in future. -- http://mail.python.org/mailman/listinfo/python-list

Re: 2.6.1 - simple division

2009-03-08 Thread Duncan Booth
farsi...@gmail.com wrote: > Thanks all, that's very helpful, sorry to waste your time with a > common question. I have tried the decimal module and will definitely > keep using it if I need to do this kind of calculation again. Try to remember though that the decimal module simply replaces one so

Re: Guidance - Professional Python Development

2009-03-08 Thread Martin P. Hellwig
RT wrote: Can you recommend any books or articles that you have found offer useful advice on program structure, design and use of classes or any other features or best practices that you feel are important for professional Python development. In my opinion, 'professional development' has sur

Re: 2.6.1 - simple division

2009-03-08 Thread farsight
Thanks all, that's very helpful, sorry to waste your time with a common question. I have tried the decimal module and will definitely keep using it if I need to do this kind of calculation again. I have 1 more question that the floating point article that was linked didn't really answer: >>> x =

Re: create boolean

2009-03-08 Thread Lie Ryan
Scott David Daniels wrote: Lie Ryan wrote: Fencer wrote: The literal translation of that would be: if n is not None and n != []: b = True else: b = False it is a bit verbose, so one might want to find something shorter b = True if n is not None and n != [] else False I always feel if and

Re: 2.6.1 - simple division

2009-03-08 Thread koranthala
On Mar 8, 7:22 pm, farsi...@gmail.com wrote: > On Mar 8, 2:16 pm, farsi...@gmail.com wrote: > > > >>> 4 / 5.0 > > > 0.84>>> 0.8 * 5 > > > 4.0 > > > python 2.6.1 on mac. What the hell is going on here? > > Pure curiosity prompted me to try the following:>>> 40 / 5.0 > > 8.0 > > Stran

Re: Callback from c thread with ctypes

2009-03-08 Thread Lie Ryan
Victor Lin wrote: On 3月8日, 下午9時56分, "Diez B. Roggisch" wrote: Victor Lin schrieb: Hi, I am going to develop a c library binding with ctypes. That c library will call callback from worker threads it created. Here comes the problem : Will the GIL be acquired before it goes into Python functio

Re: 2.6.1 - simple division

2009-03-08 Thread Lie Ryan
farsi...@gmail.com wrote: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: 4 / 5.0 0.84 This one is a common FAQ. Basically floating point is never to be trusted. This issue is quite language agnostic, however some language decided to "hide" the issue, python does not. For more

Re: Callback from c thread with ctypes

2009-03-08 Thread Christian Heimes
Victor Lin wrote > I know I have to call PyEval_InitThreads if my module create threads > that will contact python stuff, for example, call a python callback > function from threads. But however, it is ctypes. I have no idea > should I do that for the imported dll? If it is, how? You have to initi

Re: 2.6.1 - simple division

2009-03-08 Thread Gabriel Genellina
En Sun, 08 Mar 2009 12:22:50 -0200, escribió: On Mar 8, 2:16 pm, farsi...@gmail.com wrote: >>> 4 / 5.0 0.84 >>> 0.8 * 5 4.0 python 2.6.1 on mac. What the hell is going on here? Pure curiosity prompted me to try the following: 40 / 5.0 8.0 Strange... See http://docs.py

Re: Callback from c thread with ctypes

2009-03-08 Thread Victor Lin
On 3月8日, 下午10時20分, Christian Heimes wrote: > Victor Lin wrote: > > Hi, > > > I am going to develop a c library binding with ctypes. That c library > > will call callback from worker threads it created. Here comes the > > problem : Will the GIL be acquired before it goes into Python > > function? >

Re: Callback from c thread with ctypes

2009-03-08 Thread Victor Lin
On 3月8日, 下午9時56分, "Diez B. Roggisch" wrote: > Victor Lin schrieb: > > > > > Hi, > > > I am going to develop a c library binding with ctypes. That c library > > will call callback from worker threads it created. Here comes the > > problem : Will the GIL be acquired before it goes into Python > > fu

  1   2   >