Re: merging intervals repeatedly

2008-03-11 Thread Magdoll
On Mar 11, 11:01 pm, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On Tue, 11 Mar 2008 15:43:40 -0700 (PDT), Magdoll <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > Correct. I meant the final should be > > (1,30), (29,40), (50,100) > > Actually, even that is incorr

Re: best way to have enum-like identifiers?

2008-03-11 Thread castironpi
> > [enums snip] > Thus, those names are all bound to unique objects, that won't be > unexpectedly duplicated by some other value. > > > but I'm curious if there's a better way of doing this, some kind of > > enum-like thing or somesuch. > > Please try the 'enum' package in the Cheeseshop: Am I th

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread castironpi
> > Are there any that aren't persistent? > >         SQLite -- when opening a "memory" database rather than giving it a > physical file. {I'm a tad too busy to look up the format of the memory > parameter, but it shouldn't be too difficult to find it} What? If I wanted to code string literals, I

Re: merging intervals repeatedly

2008-03-11 Thread castironpi
> > Correct. I meant the final should be > > (1,30), (29,40), (50,100) > >         Actually, even that is incorrect -- note that ,30 overlaps 29, Actually, given the specification, (overlaps > N count), (1,15), (20, 30), (29, 40), (50, 66), (62,100) is right, since 66-62= 4<= 5. [1] >         Sin

base-class call decorator

2008-03-11 Thread castironpi
If you had this, class KType( BaseType ): def __init__( self, *ar, **kwar ): self.setProp= True BaseType.__init__( self, *ar, **kwar ) a lot, and wanted a decorator, what would it be? What are the pros and cons? class KType( BaseType ): @basecall def __init__( self ):

Re: best way to have enum-like identifiers?

2008-03-11 Thread Ben Finney
[EMAIL PROTECTED] writes: > Currently I'm just putting this at the top of the file: > > py=1 > funcpre=2 > funcpost=3 > ... Slightly better is: py = object() funcpre = object() funcpost = object() Thus, those names are all bound to unique objects, that won't be unex

Re: SOAP access to SharePoint

2008-03-11 Thread bryan rasmussen
It's usually not a totally mind destroying process if you hand craft your SOAP messages going off of examples from the service (if you're lucky enough they have ones) and reading their XML Schemas/WSDLs to see what they actually expect. Since it's MS do tests on your hand rolled xml with Microsoft

Re: Why no string return?

2008-03-11 Thread gargonx
On Mar 12, 5:10 am, Frank Millman <[EMAIL PROTECTED]> wrote: > gargonx wrote: > > Say i have the two methods: > > > def ReturnMethod(request, x): > > if request is True: > > return x > > else: print "No String for you...False!" > > > def SendMethod(request): > > xstring = "S

Re: Why no string return?

2008-03-11 Thread Frank Millman
gargonx wrote: > Say i have the two methods: > > def ReturnMethod(request, x): > if request is True: > return x > else: print "No String for you...False!" > > def SendMethod(request): > xstring = "Some text" > ReturnMethod(request, xstring) > > SendMethod(True) > > Why

Re: Why no string return?

2008-03-11 Thread gargonx
On Mar 12, 4:45 am, Adonis Vargas <[EMAIL PROTECTED] bellsouth.net> wrote: > gargonx wrote: > > Say i have the two methods: > > > def ReturnMethod(request, x): > > if request is True: > > return x > > else: print "No String for you...False!" > > > def SendMethod(request): > >

best way to have enum-like identifiers?

2008-03-11 Thread mh
I currently have a 2-dim hash, indexed by two strings: template['py']['funcpre'] template['py']['funcpost'] ... but I would prefer to have these indexed by constants of some kind, since this seems a bit more natural: template[py][funcpre] template[py][funcpost] ... Curre

Re: Open a file with default handler app?

2008-03-11 Thread Wubbulous
On Mar 11, 9:24 pm, [EMAIL PROTECTED] wrote: > Hi, I searched for this on google and in this group, but my awesome > google-fu powers failed me. Is there a way to open any file using > default program that'd open it? In other words, to do the same action > as double-clicking in windows explorer? An

Re: Why no string return?

2008-03-11 Thread Adonis Vargas
gargonx wrote: > Say i have the two methods: > > def ReturnMethod(request, x): > if request is True: > return x > else: print "No String for you...False!" > > def SendMethod(request): > xstring = "Some text" > ReturnMethod(request, xstring) > > SendMethod(True) > > W

Python - CGI - XML - XSD

2008-03-11 Thread xkenneth
Hi All, Quick question. I've got an XML schema file (XSD) that I've written, that works fine when my data is present as an XML file. (Served out by apache2.) Now when I call python as a cgi script, and tell it print out all of the same XML, also served up by apache2, the XSD is not applied. Doe

Why no string return?

2008-03-11 Thread gargonx
Say i have the two methods: def ReturnMethod(request, x): if request is True: return x else: print "No String for you...False!" def SendMethod(request): xstring = "Some text" ReturnMethod(request, xstring) SendMethod(True) Why does ReturnMethod not return the string

Open a file with default handler app?

2008-03-11 Thread andrei . avk
Hi, I searched for this on google and in this group, but my awesome google-fu powers failed me. Is there a way to open any file using default program that'd open it? In other words, to do the same action as double-clicking in windows explorer? And secondly, is there a way to do the same thing for l

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-11 Thread Mensanator
On Mar 11, 9:50 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > On Mar 11, 1:12 pm, Mensanator <[EMAIL PROTECTED]> wrote: > > > > > > > On Mar 11, 3:36 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > > Mensanator <[EMAIL PROTECTED]> wrote: > > > > On Mar 10, 10:44‹¨«pm, Nathan Pinno <[EMAIL PROTECT

RE: Looking for very light weight template library (not framework)

2008-03-11 Thread Sells, Fred
As I recall Quixote allowed you to embed html in python. was actually pretty cool. Havenot tried it in a long time. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Behalf Of Malcolm Greene > Sent: Thursday, March 06, 2008 8:56 PM > To: python-list@python.org

Max File Size

2008-03-11 Thread xkenneth
Is the max file size a relevant issue in python anymore? I know OS X has a max file size of 8 exabytes and I'm not sure about the latest version of Ubuntu. Does python have an independent file size limit, or is it dependent upon the OS it was compiled on? Regards, Kenneth Miller -- http://mail.py

app runs fine with interpreter, but not under py2exe

2008-03-11 Thread Doug Morse
Hi, I have an application that runs just fine using the standard Python distro interpreter (v2.5.1 on WinXP) but throws the following exception when run as an executable built with py2exe. My questions are: (a) does anyone have any thoughts on why this exception is occurring and what to do about

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-11 Thread Nathan Pinno
On Mar 11, 1:12 pm, Mensanator <[EMAIL PROTECTED]> wrote: > On Mar 11, 3:36 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > > > Mensanator <[EMAIL PROTECTED]> wrote: > > > On Mar 10, 10:44‹¨«pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > >> Why does my compiler say invalid syntax and then highlight

Re: Distributed App - C++ with Python for Portability?

2008-03-11 Thread Jeff Schwab
Roopan wrote: > I assume the C++/Python binding is fairly painless. http://www.boost.org/libs/python/doc/tutorial/doc/html/index.html A. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Time Zone application after strptime?

2008-03-11 Thread [EMAIL PROTECTED]
On Mar 11, 11:00 am, Jim Carroll <[EMAIL PROTECTED]> wrote: (snipped) > > p.parse("10:29:52 Feb 29, 2008 PST", tzinfos=zones) > datetime.datetime(2008, 2, 29, 10, 29, 52, tzinfo=tzoffset('PST', -28800)) > > But I cannot figure out how to get dateutil to use the > zoneinfo file that it includes in

Py2exe and Multi Treading problem.

2008-03-11 Thread Farsheed Ashouri
Here is my script #** #** import threading import socket def openSocket(portNum): mySocket = socket.socket ( socket.AF_INET, socket.SOCK_STREAM ) mySocket.

Re: how to pass the workspace ?

2008-03-11 Thread Gary Herron
Stef Mientki wrote: > hello, > > I've GUI tree with drag and drop nodes, > where each nodes contains a code snippet. > Now I want to run one or more branches in that tree, > so I enumerate over the nodes and have to run something like this: > > execfile ( node1 ) > execfile ( node2 ) > etc.. > > No

how to pass the workspace ?

2008-03-11 Thread Stef Mientki
hello, I've GUI tree with drag and drop nodes, where each nodes contains a code snippet. Now I want to run one or more branches in that tree, so I enumerate over the nodes and have to run something like this: execfile ( node1 ) execfile ( node2 ) etc.. Now how do I pass the workspace created in

Re: The stange behaviour of Tkinter.Canvas

2008-03-11 Thread John McMonagle
James Yu wrote: > I tried to update the rectangle on a canvas to get the visual effect of > progressbar. > It works all right if I delete the existing objects (rectangle and text) > and create a new one. > However, if I invoke canvas.itemconfig() to update the existing objects' > options, gui just

catching object

2008-03-11 Thread Igor V. Rafienko
Hi, I was wondering if someone could help me explain this situation: h[1] >>> import inspect h[1] >>> inspect.getmro(ValueError) (, , , , ) h[2] >>> try: raise ValueError("argh") except object: print "why not?" Traceback (most recent call last): File "", line 2, in ValueError: argh

Re: min/max: "stable" invariant?

2008-03-11 Thread Terry Reedy
"Giovanni Bajo" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello, | | assuming that a sequence contains multiple elements with minimum/maximum | value, do min/max guarantee to return the *first* element in the sequence | among those? | | Example: | | >>> class A: | ... def

RE: Obtaining the PyObject * of a class

2008-03-11 Thread Cooper, Andrew
The part I'm having problem with is as follows: I want to replace the 'strcmp' below with a call to PyObject_IsInstance(o, pinClassPyObject) But I don't know how to get the PyObject* for the Pin class that is defined in the %pythoncode section Here is a cut down version of the interf

min/max: "stable" invariant?

2008-03-11 Thread Giovanni Bajo
Hello, assuming that a sequence contains multiple elements with minimum/maximum value, do min/max guarantee to return the *first* element in the sequence among those? Example: >>> class A: ... def __init__(self, x): self.x = x ... >>> L = [A(0), A(1), A(2), A(0)] >>> min(L, key=lambda a:a

Re: merging intervals repeatedly

2008-03-11 Thread Magdoll
Correct. I meant the final should be (1,30), (29,40), (50,100) On Mar 11, 3:41 pm, Magdoll <[EMAIL PROTECTED]> wrote: > Hi, > > I have to read through a file that will give me a bunch of intervals. > My ultimate goal is to produce a final set of intervals such that not > two intervals overlap by m

merging intervals repeatedly

2008-03-11 Thread Magdoll
Hi, I have to read through a file that will give me a bunch of intervals. My ultimate goal is to produce a final set of intervals such that not two intervals overlap by more than N, where N is a predetermined length. For example, I could read through this input: (1,10), (3,15), (20,30),(29,40),(5

How to import a module that must override a standard one

2008-03-11 Thread ilochab
I'm writing a python package that will contain a logging service for twisted in python style. I'm using some modules I downloaded from a twisted trunk, that are not released with twisted but have the same names. One of them is log.py that is usually imported from twisted modules like: from twis

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread castironpi
> >  Thanks, that makes sense. Are there any local relational databases > >  available to python that don't require a server backend? > > sqlite > http://www.sqlite.org/ Are there any that aren't persistent? -- http://mail.python.org/mailman/listinfo/python-list

Re: python interactive - threaded console (run -i)

2008-03-11 Thread castironpi
>         self._doneevents= {} is extraneous. > id, fun, ar, kw= self.get() done, fun, ar, kw= self.get() suffices. > def _draintilclose( conn, understandfun= None ): >         if None is not understandfun: >             understandfun( _curmsg ) yield _curmsg is an interesti

Re: Problem with zipfile and newlines

2008-03-11 Thread neilcrighton
I think I've worked it out after reading the 'Binary mode for files' section of http://zephyrfalcon.org/labs/python_pitfalls.html zipfile extracts as file as a binary series of characters, and I'm writing out this binary file as a text file with open('foo','w'). Normally Python converts a '\n' in

SOAP access to SharePoint

2008-03-11 Thread Paul Watson
Has anyone successfully accessed a Microsoft SharePoint WSS using Python? No, not IronPython. I need for this to be able to run on all machines the customer might choose. Which libs are you using? ZSI, SOAPpy, soaplib, ??? http://wiki.python.org/moin/WebServices -- http://mail.python.org/mai

Re: any library for SOAP 1.1 or SOAP 1.2?

2008-03-11 Thread Paul Watson
On Fri, 2008-01-25 at 16:52 +0530, Amogh Hooshdar wrote: > Hi, > > I wish to know which python library is popular for SOAP related > programming, especially for sending SOAP requests and parsing SOAP > responses. > > I can't find any such library in the Python standard library but I > could find

RE: Obtaining the PyObject * of a class

2008-03-11 Thread Bronner, Gregory
I'd strongly disagree. SWIG is very useful for wrapping large scale projects in a non-interfering manner. If you have to generate bindings for 1000+ classes, it is by far the easiest way to do things. It isn't clear what you are doing that requires the PyObject*, or which one you'd like. In g

Re: Problem with zipfile and newlines

2008-03-11 Thread neilcrighton
Sorry my initial post was muddled. Let me try again. I've got a zipped archive that I can extract files from with my standard archive unzipping program, 7-zip. I'd like to extract the files in python via the zipfile module. However, when I extract the file from the archive with ZipFile.read(), it

[ANN] Python 2.3.7 and 2.4.5 (final)

2008-03-11 Thread Martin v. Löwis
On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.4.5 and 2.3.7 (final). Both releases include only security fixes. Python 2.5 is the latest version of Python, we're making this release for people who are still running Python 2.3 or 2.

Re: urllib proxy support confusion

2008-03-11 Thread Mark Dickinson
On Mar 11, 12:26 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: > Before I submit a bug, I'll give it a try to find out if it > does support explicit specification of proxys or not. Sounds good. If it does, then I think the whole paragraph (from "The urlopeen() function does not support explicit pr

Re: mulithreaded server

2008-03-11 Thread castironpi
> > >In the above program, why there is an unhandeled exception ??? > > > Just a guess. You should really include the traceback when you ask a > > question like this. > > It's not a traceback error. It's an unhandeled exception. Have a look at this: http://groups.google.com/group/comp.lang.python

Re: Regarding coding style

2008-03-11 Thread castironpi
On Mar 11, 11:31 am, Lie <[EMAIL PROTECTED]> wrote: > On Mar 10, 4:16 am, [EMAIL PROTECTED] wrote: > > > > > > > On Mar 9, 4:25 am, Lie <[EMAIL PROTECTED]> wrote: > > > > On Mar 9, 3:27 am, [EMAIL PROTECTED] wrote: > > > > > To Lie: > > > > > > Personally I preferred a code that has chosen good nam

Re: mulithreaded server

2008-03-11 Thread Aahz
In article <[EMAIL PROTECTED]>, asit <[EMAIL PROTECTED]> wrote: >On Mar 11, 9:10 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: >> On Tue, 11 Mar 2008 08:24:54 -0700 (PDT), asit <[EMAIL PROTECTED]> wrote: >>> >>>In the above program, why there is an unhandeled exception ??? >> >> Just a guess.

Re: How to factor using Python?

2008-03-11 Thread Mensanator
On Mar 11, 10:57 am, Mike Hansen <[EMAIL PROTECTED]> wrote: > If one wants to do serious math using Python, the best bet is to use > Sage (http://www.sagemath.org).  Here are some examples: > > sage: def f(x, bits=53): > :     R = RealField(bits); z = R(x) > :     return cos(R(pi) * factori

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Lie
(If there is anything weird that I say, please ignore it since I'm writing this half-sleeping) On Mar 12, 12:00 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: (snip) > I totally fail to see where > > raise Equal(a, b) > > is less cluttered or not than > > callback(a, b) > > Actually, the latte

Re: mulithreaded server

2008-03-11 Thread asit
On Mar 11, 9:10 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Tue, 11 Mar 2008 08:24:54 -0700 (PDT), asit <[EMAIL PROTECTED]> wrote: > >import socket > >import sys > >import thread > > >p=1 > >PORT=11000 > >BUFSIZE=1024 > > >def getData(cSocket): > >global stdoutlock,cSocketlock > >

Re: Why does my compiler say invalid syntax then highlight...?

2008-03-11 Thread Mensanator
On Mar 11, 3:36 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Mensanator <[EMAIL PROTECTED]> wrote: > > On Mar 10, 10:44‹¨«pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > >> Why does my compiler say invalid syntax and then highlight the > >> quotation marks in the following code: > > >> # This progra

Re: How to make a Tkinter widget always visible?

2008-03-11 Thread Kevin Walzer
Miki wrote: > Hello Kevin, > >>> Is there a way to make sure that these buttons are always visible? >> There are various ways to do this: you can set the window to be >> non-resizable, or set a minimum size to it, so that it can't be resized >> below that level. However, if you allow arbitrary res

Re: How to make a Tkinter widget always visible?

2008-03-11 Thread Miki
Hello Kevin, > > Is there a way to make sure that these buttons are always visible? > > There are various ways to do this: you can set the window to be > non-resizable, or set a minimum size to it, so that it can't be resized > below that level. However, if you allow arbitrary resizing of the > wi

Re: Obtaining the PyObject * of a class

2008-03-11 Thread Michael Wieher
2 things: 1st. there is a python mailing list for people interested in C++ extension type stuff 2nd. SWIG is useless and overly complicated, its much easier to just generate your own C++ code by hand, less confusion, and much more clarity. I find no value in using anything else. People complain ab

Re: Obtaining the PyObject * of a class

2008-03-11 Thread Chris Mellon
On Tue, Mar 11, 2008 at 12:13 PM, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Cooper, Andrew" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > | Are there any Python C API experts/SWIG experts out there that can help > | me with this issue please. > > | I',m currently using SWIG

help regarding xml parser modules

2008-03-11 Thread Vinay Aiya
Hello, Can any one help for error in following code. actually i want to map the element name with its data between start and end tag , but i am unable to do so. here is the code which i am trying for please do reply if i am not on right track. import xml.sax.handler class BookHandler(xml.sax.ha

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Steven D'Aprano
On Mon, 10 Mar 2008 12:14:40 -0700, [EMAIL PROTECTED] wrote: > Common Lisp has two ways of raising: functions "error" and "signal". > Python's "raise" is like CL's "error": you end up in the debugger if the > exception is not handled. Exceptions that are raised by CL's "signal" > don't have to be

Re: Time Zone application after strptime?

2008-03-11 Thread Jim Carroll
M.-A. Lemburg egenix.com> writes: > > On 2008-03-07 22:24, Jim Carroll wrote: > > It's taken me a couple of hours to give up on strptime > > with %Z for recognizing > > time zones... but that still leaves me in the wrong zone: > > > > How can I use the "PST" (or any other time zone name) > >

Re: How to make a Tkinter widget always visible?

2008-03-11 Thread Kevin Walzer
Miki wrote: > Hello, > > I have a simple Tkinter window with [GO] and [Quit] buttons at the > bottom. > > When I resize the window to be shorter, the first thing to disappear > are the buttons, however I want these button to be visible at all > times. > > Is there a way to make sure that these b

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Steven D'Aprano
On Tue, 11 Mar 2008 03:14:54 -0700, Lie wrote: >> Regarding the number of callbacks: you can as well pass an object that >> has several methods to call. > > If you passed an object that has several methods to call (using tuple or > list) and you want to handle several softexceptions and ignore so

XML-SAX parser problem

2008-03-11 Thread hitesh thakkar
Hello, Can any one help for error in following code. actually i want to map parent element with child element, but i am unable to do so. here is the code which i am trying for please do reply if iam not on right track. import xml.sax.handler class BookHandler(xml.sax.handler.ContentHandler):

Re: Exctract GIF comment from image

2008-03-11 Thread Guilherme Polo
2008/3/11, [EMAIL PROTECTED] <[EMAIL PROTECTED]>: > Hi, > > simple question: The PIL does not support reading the optional > description in GIF Images. > > http://www.pythonware.com/library/pil/handbook/format-gif.htm > > After some reasearch I could not find a python solution for this, any >

Re: Exctract GIF comment from image

2008-03-11 Thread Miki
Hello Wingi, > simple question: The PIL does not support reading the optional > description in GIF Images. > > http://www.pythonware.com/library/pil/handbook/format-gif.htm > > After some reasearch I could not find a python solution for this, any > suggestions? Use ImageMagick (www.imagemagick.org

Re: Check For SELF Variable Existance

2008-03-11 Thread Terry Reedy
"Robert Rawlins" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Thank you Simon, | | I was hoping there would be something as simple as that :-) | >>> class Spam(object): | ... def egg(self): | ... if hasattr(self, 'chips'): print 'got chips!' I strongly suggest that y

How to make a Tkinter widget always visible?

2008-03-11 Thread Miki
Hello, I have a simple Tkinter window with [GO] and [Quit] buttons at the bottom. When I resize the window to be shorter, the first thing to disappear are the buttons, however I want these button to be visible at all times. Is there a way to make sure that these buttons are always visible? Than

Re: Obtaining the PyObject * of a class

2008-03-11 Thread Terry Reedy
"Cooper, Andrew" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Are there any Python C API experts/SWIG experts out there that can help | me with this issue please. | I',m currently using SWIG to generate a python interface to a C DLL. Some people have switched to using ctypes for

Re: How to factor using Python?

2008-03-11 Thread Shane Geiger
def fact(x): if x == 1: return 1 # don't forget this else: return x * fact(x - 1) print fact(5) > Factorial algorithm is a very simple and common algorithm, and it's > one of the most basic of all recursive algorithm > def fact(x): > return x * fact(x - 1) > > That recursive functio

Re: How to factor using Python?

2008-03-11 Thread Lie
On Mar 11, 11:47 pm, Lie <[EMAIL PROTECTED]> wrote: > On Mar 10, 12:08 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > > How do I factor a number? I mean how do I translate x! into proper > > Python code, so that it will always do the correct math? > > > Thanks in advance, > > Nathan P. > > Factori

Re: What c.l.py's opinions about Soft Exception?

2008-03-11 Thread Diez B. Roggisch
> If you passed an object that has several methods to call (using tuple > or list) and you want to handle several softexceptions and ignore some > others, you must still pass an empty methods to the one you want to > ignore, cluttering the caller's code by significant degree: > > def somefunc

Exctract GIF comment from image

2008-03-11 Thread wingi
Hi, simple question: The PIL does not support reading the optional description in GIF Images. http://www.pythonware.com/library/pil/handbook/format-gif.htm After some reasearch I could not find a python solution for this, any suggestions? Thanx, Wingi. -- http://mail.python.org/mailman/listinf

Re: How to factor using Python?

2008-03-11 Thread Lie
On Mar 10, 12:08 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > How do I factor a number? I mean how do I translate x! into proper > Python code, so that it will always do the correct math? > > Thanks in advance, > Nathan P. Factorial algorithm is a very simple and common algorithm, and it's one of

Re: Regarding coding style

2008-03-11 Thread Lie
On Mar 10, 4:16 am, [EMAIL PROTECTED] wrote: > On Mar 9, 4:25 am, Lie <[EMAIL PROTECTED]> wrote: > > > On Mar 9, 3:27 am, [EMAIL PROTECTED] wrote: > > > > To Lie: > > > > > Personally I preferred a code that has chosen good names but have > > > > little or no comments compared to codes that makes b

Re: urllib proxy support confusion

2008-03-11 Thread Grant Edwards
On 2008-03-11, Mark Dickinson <[EMAIL PROTECTED]> wrote: >> That seems a bit baffling.  If it urlopen doesn't support >> specifying proxies, why are there examples showing how to do >> it? If it does support specifying proxies, what is the >> pragraph quoted above supposed to mean? > > Looks like

Re: wxPython/wxWidgets ok for production use ?

2008-03-11 Thread Chris Mellon
On Tue, Mar 11, 2008 at 11:01 AM, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Sion Arrowsmith wrote: > > And before you blame wx* for crashes: what platform was this on? > > Because my experience was that wx on GTK was significantly more prone > > to glitches than on Windows (through to wxglade b

Python Contract/Job Opportunity

2008-03-11 Thread Trevor Hennion
InfoCentrality are a small company who provided a custom Web/Database application for a customer in the Insurance industry. Our customer now wants a number of improvements to this application. To provide these improvements in a timely manner we need an additional programmer. 3 months contract

Re: mulithreaded server

2008-03-11 Thread Jean-Paul Calderone
On Tue, 11 Mar 2008 08:24:54 -0700 (PDT), asit <[EMAIL PROTECTED]> wrote: >import socket >import sys >import thread > >p=1 >PORT=11000 >BUFSIZE=1024 > >def getData(cSocket): >global stdoutlock,cSocketlock >while True: >cSocketlock.acquire() >data=cSocket.recv(BUFSIZE) >

Re: wxPython/wxWidgets ok for production use ?

2008-03-11 Thread Stefan Behnel
Sion Arrowsmith wrote: > And before you blame wx* for crashes: what platform was this on? > Because my experience was that wx on GTK was significantly more prone > to glitches than on Windows (through to wxglade being unusably crashy) > -- if the underlying toolkit has problems, that's going to be

Re: urllib proxy support confusion

2008-03-11 Thread Mark Dickinson
On Mar 11, 11:35 am, Grant Edwards <[EMAIL PROTECTED]> wrote: > That seems a bit baffling.  If it urlopen doesn't support > specifying proxies, why are there examples showing how to do > it? If it does support specifying proxies, what is the pragraph > quoted above supposed to mean? Looks like a d

Re: __iter__ yield

2008-03-11 Thread Lie
On Mar 10, 3:58 am, duccio <[EMAIL PROTECTED]> wrote: > Hello! > Someone knows if it's possible to make this __iter__ function with just > one 'yield' intead of two? > Is there some simpler way to make this __iter__ iter through all nodes? > Thanks! > > class Node: > def __init__(self, data=N

Re: How to factor using Python?

2008-03-11 Thread Mike Hansen
If one wants to do serious math using Python, the best bet is to use Sage ( http://www.sagemath.org ). Here are some examples: sage: def f(x, bits=53): : R = RealField(bits); z = R(x) : return cos(R(pi) * factorial(z-1) / z) sage: f(100.00,bits=1000) 0.

Re: Python PDF + Pictures

2008-03-11 Thread jeffself
On Mar 11, 5:00 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, dear Python Masters! > > I wanna ask about the Python and PDF creating. > > I have many photos, and I wanna make some "presentation" from these > photos, a "thumbnail" like document with one image per one page. > > If I wanna

urllib proxy support confusion

2008-03-11 Thread Grant Edwards
Reading through the doc at http://docs.python.org/lib/module-urllib.html, there are several paragraphs (including code examples) showing how you specify what proxies to use when calling urlopen(): Alternatively, the optional proxies argument may be used to explicitly specify proxies. [...]

mulithreaded server

2008-03-11 Thread asit
import socket import sys import thread p=1 PORT=11000 BUFSIZE=1024 def getData(cSocket): global stdoutlock,cSocketlock while True: cSocketlock.acquire() data=cSocket.recv(BUFSIZE) if data=='q': data='client exited' cSocket.close()

Re: wxPython/wxWidgets ok for production use ?

2008-03-11 Thread Sion Arrowsmith
Stefan Behnel <[EMAIL PROTECTED]> wrote: >Just to make this sound a bit less like FUD: my last experience with wxPython >dates back a couple of years (2004/5?), but back then, we used BoaConstructor >in a project, which crashed a bit too often to do real work with it - and with >crashing I mean cr

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread Joe Riopel
On Tue, Mar 11, 2008 at 10:58 AM, davidj411 <[EMAIL PROTECTED]> wrote: > Thanks, that makes sense. Are there any local relational databases > available to python that don't require a server backend? sqlite http://www.sqlite.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to factor using Python?

2008-03-11 Thread Neal Becker
Nathan Pinno wrote: > How do I factor a number? I mean how do I translate x! into proper > Python code, so that it will always do the correct math? > > Thanks in advance, > Nathan P. import os os.system('factor 25') -- http://mail.python.org/mailman/listinfo/python-list

ZSI and attachments

2008-03-11 Thread Laszlo Nagy
Hi All, I wonder if the newest ZSI has support for attachments? Last time I checked (about a year ago) this feature was missing. I desperately need it. Alternatively, is there any other SOAP lib for python that can handle attachments? Thanks, Laszlo -- http://mail.python.org/mailman/l

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread davidj411
> Persistent storage /is/ the benefit. If you want to store relational > data, you should use a relational database. Thanks, that makes sense. Are there any local relational databases available to python that don't require a server backend? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to factor using Python?

2008-03-11 Thread Mark Dickinson
On Mar 10, 7:32 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Thanks on the factoring bit, but I did mean factorial, not factoring. > How do I code that correctly, so that I can figure the following > equation out: cos(Pi * (z-1)! / z). Python returns a invalid syntax > error and highlight the !. S

Re: How to factor using Python?

2008-03-11 Thread Joe Riopel
On Tue, Mar 11, 2008 at 10:38 AM, Joe Riopel <[EMAIL PROTECTED]> wrote: > On Mon, Mar 10, 2008 at 1:08 AM, Nathan Pinno <[EMAIL PROTECTED]> wrote: > > How do I factor a number? I mean how do I translate x! into proper > > Python code, so that it will always do the correct math? > > This should

Re: How to factor using Python?

2008-03-11 Thread Joe Riopel
On Mon, Mar 10, 2008 at 1:08 AM, Nathan Pinno <[EMAIL PROTECTED]> wrote: > How do I factor a number? I mean how do I translate x! into proper > Python code, so that it will always do the correct math? This should work to do x! (factorial of x). reduce(lambda x,y: x*y, range(1, x+1)) -- http://m

how to theme/skin pyGtk apps

2008-03-11 Thread binaryj
hi again dear group. what i am interested in is giving my pygtk app some distinct look, a lil childish look coz the app is for children. so, i downloaded a couple of themes from http://art.gnome.org/themes/gtk2/ and for the past 1 hr i have been trying to theme my app but with no results. could

Re: How to factor using Python?

2008-03-11 Thread Mark Dickinson
On Mar 10, 7:32 pm, Nathan Pinno <[EMAIL PROTECTED]> wrote: > Thanks on the factoring bit, but I did mean factorial, not factoring. > How do I code that correctly, so that I can figure the following > equation out: cos(Pi * (z-1)! / z). Is z an integer in this expression? (Note: it's not an equat

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread Robert Bossy
davidj411 wrote: > anydbm and dictionary{} seem like they both have a single key and key > value. > Can't you put more information into a DBM file or link tables? I just > don't see the benefit except for the persistent storage. Except for the persistent storage, that insignificant feature... ;) We

Re: difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread Carsten Haese
On Tue, 2008-03-11 at 06:49 -0700, davidj411 wrote: > anydbm and dictionary{} seem like they both have a single key and key > value. > Can't you put more information into a DBM file or link tables? I just > don't see the benefit except for the persistent storage. Persistent storage /is/ the benefi

difference b/t dictionary{} and anydbm - they seem the same

2008-03-11 Thread davidj411
anydbm and dictionary{} seem like they both have a single key and key value. Can't you put more information into a DBM file or link tables? I just don't see the benefit except for the persistent storage. d= dbm.open('c:\\temp\\mydb.dat','n') It has the following interface (key and data are string

RE: SQLObject 0.10.0

2008-03-11 Thread Robert Rawlins
Excellent stuff Oleg, I've been looking for an ORM framework for a while and hadn't settled on one, I'll give this a look through later today. Thanks, Robert -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Oleg Broytmann Sent: 11 March 2008 13:40 To: Pyt

Re: parsing directory for certain filetypes

2008-03-11 Thread Tim Chase
royG wrote: > On Mar 10, 8:03 pm, Tim Chase wrote: > >> In Python2.5 (or 2.4 if you implement the any() function, ripped >> from the docs[1]), this could be rewritten to be a little more >> flexible...something like this (untested): >> > > that was quite a good lesson for a beginner like me.. >

RE: Check For SELF Variable Existance

2008-03-11 Thread Robert Rawlins
Thank you Simon, I was hoping there would be something as simple as that :-) Rob -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simon Brunning Sent: 11 March 2008 13:21 To: python-list@python.org Subject: Re: Check For SELF Variable Existance On Tue, M

SQLObject 0.10.0

2008-03-11 Thread Oleg Broytmann
Hello! I'm pleased to announce version 0.10.0, the first stable release of 0.10 branch of SQLObject. What is SQLObject = SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be e

Re: parsing directory for certain filetypes

2008-03-11 Thread jay graves
On Mar 11, 12:21 am, royG <[EMAIL PROTECTED]> wrote: > On Mar 10, 8:03 pm, Tim Chase wrote: > in the version using glob() > > >path = os.path.normpath(os.path.join(folder, '*.txt')) > >lst = glob.glob(path) > > is it possible to check for more than one file extension? here i will > have to create

  1   2   >