Re: wxStyledTextCtrl - Dead?

2006-04-10 Thread David Rasmussen
Dave Mandelin wrote: > I don't know the answers to 1 and 2, but from the demo I know that the > answer to 3 is wx.stc.StyledTextControl. > > As for 4, I guess it depends on what you want to do. StyledTextControl > looked pretty scary to me, and for my application I mainly needed to > display style

Re: how relevant is C today?

2006-04-10 Thread David Rasmussen
Thomas Bellman wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > >> "const" is in C89/C90. > > Although with slightly different semantics from in C++... For > instance: > > static const int n = 5; > double a[n]; > > is valid C++, but not valid C. > There are other difference

Re: how relevant is C today?

2006-04-10 Thread David Rasmussen
Lawrence D'Oliveiro wrote: > In article <[EMAIL PROTECTED]>, > David Rasmussen <[EMAIL PROTECTED]> wrote: > >> In my everyday work, I am forced to use a C90 only compiler, and >> everyday I miss some C++ feature that wouldn't make my program any more

Re: how relevant is C today?

2006-04-09 Thread David Rasmussen
Mirco Wahab wrote: > > I would say, from my own experience, that you wouldn't > use all C++ features in all C++ projects. Most people > I know would write C programs 'camouflaged' as C++, > that is: write clean & simple C - and use some C++ > features e.g, class bound methods for interfaces - > bu

wxStyledTextCtrl - Dead?

2006-04-09 Thread David Rasmussen
I have several questions about wxStyledTextCtrl: 1) Is it still being maintained? 2) Where are the docs and tutorials? 3) Is it wxStyledTextCtrl, wx.StyledTextCtrl, StyledTextCtrl, or... ? 4) Is there an alternative? /David -- http://mail.python.org/mailman/listinfo/python-list

Re: How to check if a string "is" an int?

2005-12-21 Thread David Rasmussen
Daniel Schüle wrote: > > others already answered, this is just an idea > I guess, if we want to avoid the exception paradigm for a particular problem, we could just do something like: def isNumber(n): try: dummy = int(n) return True except ValueError: return

Re: ANN: Dao Language v.0.9.6-beta is release!

2005-12-07 Thread David Rasmussen
Antoon Pardon wrote: >> >>Write shorter functions ;) > > This has little to do with long functions. A class can contain > a large number of methods, whitch are all rather short, and your > class will still be spread over several pages. > Write classes with a smaller interface ;-) /David -- htt

Re: python speed

2005-12-06 Thread David Rasmussen
bruno at modulix wrote: > > There's nothing like "pure" Python. Python depends on a lot of libs, > most of them being coded in C++ or C (or assembly FWIW). The common > scheme is to use Python for the logic and low-level libs for the > critical parts. > I know. But if a discussion like this is t

Re: python speed

2005-12-06 Thread David Rasmussen
Peter Hansen wrote: >> >>> From the speed requirement: Is that correspondance chess by any chance?? >> >> Regular chess at tournament time controls requires speed too. Any pure >> Python chess program would lose badly to the best C/C++ programs out >> there now. >> >> I would also like to see Hal

Re: python speed

2005-12-06 Thread David Rasmussen
Harald Armin Massa wrote: >>Faster than assembly? LOL... :) > > why not? Because any program generated automatically by a compiler of any kind can always be expressed in assembly langauge. That writing assembler for many processors can be really hard to do well is beside the point. We're talk

Re: python speed

2005-12-06 Thread David Rasmussen
Steve Holden wrote: >> >> Faster than assembly? LOL... :) >> > I don't see why this is so funny. A good C compiler with optimization > typically produces better code than an equivalent assembly language > program. As compilation techniques improve this gap is likely to widen. > There's less and

Re: python speed

2005-11-30 Thread David Rasmussen
Harald Armin Massa wrote: > Dr. Armin Rigo has some mathematical proof, that High Level Languages > like esp. Python are able to be faster than low level code like > Fortran, C or assembly. > Faster than assembly? LOL... :) /David -- http://mail.python.org/mailman/listinfo/python-list

Re: python speed

2005-11-30 Thread David Rasmussen
Frithiof Andreas Jensen wrote: > > From the speed requirement: Is that correspondance chess by any chance?? > Regular chess at tournament time controls requires speed too. Any pure Python chess program would lose badly to the best C/C++ programs out there now. I would also like to see Half Li

Making a persistent HTTP connection

2005-11-14 Thread David Rasmussen
I use urllib2 to do some simple HTTP communication with a web server. In one "session", I do maybe 10-15 requests. It seems that urllib2 opens op a connection every time I do a request. Can I somehow make it use _one_ persistent connection where I can do multiple GET->"receive data" passes befo

HTTP Keep-Alive with urllib2

2005-11-14 Thread David Rasmussen
Someone once asked about this an got no answer: http://groups.google.dk/group/comp.lang.python/browse_frm/thread/c3cc0b8d7e9cbc2/ff11efce3b1776cf?lnk=st&q=python+http+%22keep+alive%22&rnum=84&hl=da#ff11efce3b1776cf Maybe I am luckier :) Does anyone know how to do Keep-Alive with urllib2, that is

Python Book

2005-11-13 Thread David Rasmussen
What is the best book for Python newbies (seasoned programmer in other languages)? /David -- http://mail.python.org/mailman/listinfo/python-list

Multikey Dict?

2005-11-12 Thread David Rasmussen
If I have a collection of dicts like: john = {'id': 1, 'name': "John Cleese", 'year': 1939} graham = {'id': 2, 'name': "Graham Chapman", 'year': 1941} I could store all of them in a list. But for easy lookup, I might store all these in a dict instead, like people = {'1': john, '2': graham} or

Re: Python as a HTTP Client

2005-11-10 Thread David Rasmussen
James Tanis wrote: > If you haven't discovered www.python.org yet I suggest going there :P. > You will find there the documentation you need under the conspicuous > name library reference. Specifically the modules you'd probably most > be interested in are urllib/urllib2/httplib depending on what y

Re: Python as a HTTP Client

2005-11-10 Thread David Rasmussen
Fuzzyman wrote: > ``urllib2`` is the standard library module you need. > > I've written a guide to using it (although it's very easy - but some > attributes of the errors it can raise aren't documented) : > > http://www.voidspace.org.uk/python/articles/urllib2.shtml > > All the best, > > Fu

Getting a function name from string

2005-11-02 Thread David Rasmussen
If I have a string that contains the name of a function, can I call it? As in: def someFunction(): print "Hello" s = "someFunction" s() # I know this is wrong, but you get the idea... /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-11-02 Thread David Rasmussen
Steven D'Aprano wrote: > > 0x0100 is one of a number of unique start codes in the MPEG2 > standard. It is guaranteed to be unique in the video stream, however > when searching for codes within the video stream, make sure you're in > the video stream! > I know I am in the cases I am intere

Re: Python's website does a great disservice to the language

2005-11-01 Thread David Rasmussen
Steve Holden wrote: > > [Thinks: wonder if it's time to release a sneak preview]. > It is! It is! /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-11-01 Thread David Rasmussen
Steven D'Aprano wrote: > > However, there may be a simpler solution *fingers crossed* -- you are > searching for a sub-string "\x00\x00\x01\x00", which is hex 0x100. > Surely you don't want any old substring of "\x00\x00\x01\x00", but only > the ones which align on word boundaries? > Nope, so

Re: Scanning a file

2005-11-01 Thread David Rasmussen
Bengt Richter wrote: > > Good point, but perhaps the bit pattern the OP is looking for is guaranteed > (e.g. by some kind of HDLC-like bit or byte stuffing or escaping) not to occur > except as frame marker (which might make sense re the problem of re-synching > to frames in a glitched video strea

Re: Scanning a file

2005-11-01 Thread David Rasmussen
Lasse Vågsæther Karlsen wrote: > David Rasmussen wrote: > > >> If you must know, the above one-liner actually counts the number of >> frames in an MPEG2 file. I want to know this number for a number of >> files for various reasons. I don't want it to take fore

Re: Scanning a file

2005-10-30 Thread David Rasmussen
No comments to this post? /David -- http://mail.python.org/mailman/listinfo/python-list

Re: Scanning a file

2005-10-29 Thread David Rasmussen
Steven D'Aprano wrote: > On Fri, 28 Oct 2005 06:22:11 -0700, [EMAIL PROTECTED] wrote: > >>Which is quite fast. The only problems is that the file might be huge. > > What *you* call huge and what *Python* calls huge may be very different > indeed. What are you calling huge? > I'm not saying that

Re: Scanning a file

2005-10-29 Thread David Rasmussen
[EMAIL PROTECTED] wrote: > I think implementing a finite state automaton would be a good (best?) > solution. I have drawn a FSM for you (try viewing the following in > fixed width font). Just increment the count when you reach state 5. > > <---| >