Re: wxPython vs. pyQt
Hans-Peter Jansen wrote: .. While in PyQt world, I found these advantages: + conceptually vastly superior + powerful api/widgets/features + fast as hell due to the efficient binding of a quite efficient lib + cool tools, that are unicode/translation aware + very efficient programming environment/unbeatable productivity While this sounds like the average sales talk, I will try to backup these claims a bit: > .. I've been a wx user since around 1999 and overall I like it. It annoys me a *lot* sometimes, but as Qt was always prohibitively expensive for commercial development, it was the only real option. The key question from my point of view is: can I write commercial sell-if-I-want-to applications using Qt? If it is GPL, then I guess the answer is 'no'? Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: wxPython vs. pyQt
John J. Lee wrote: The key question from my point of view is: can I write commercial sell-if-I-want-to applications using Qt? If it is GPL, then I guess the answer is 'no'? Yes, you can write commercial apps. It's multi-licensed (commercial, GPL, etc.): you get to pick the license(s) you want to use. Read the licenses. PyQt's licensing follows Qt's very closely, so no real complications there. Note PyQt (including a Qt license for use only with PyQt) is actually far cheaper than Qt alone (if you buy Blackadder). ok, thanks. I've just had a quick browse of the licence notes at the PyQt website. I guess I meant: "can I write commercial closed-source software *without paying anything for Qt" - to which I sounds like the answer is definitely "No" :) Andrew -- http://mail.python.org/mailman/listinfo/python-list
module to parse "pseudo natural" language?
Hi all I've written a python program that adds orders into our order routing simulation system. It works well, and has a syntax along these lines: ./neworder --instrument NOKIA --size 23 --price MARKET --repeats 20 etc However, I'd like to add a mode that will handle, say: ./neworder buy 23 NOKIA at MKT x 20 I could enter several orders either by running multiple times, or use a comma-separated approach, like: ./neworder buy 23 NOKIA at MKT on helsinki, sell 20 NOKIA at market on helsinki The thing about this is that its a "tolerant" parser, so all of these should also work: # omit words like "at", "on" ./neworder buy 23 NOKIA mkt helsinki # take any symbol for helsinki ./neworder buy 23 mkt helsinki # figure out that market=helsinki ./neworder buy 23 NOKIA at market price I've started writing a simple state-based parser, usage like: class NaturalLanguageInsructionBuilder: def parse( self, arglist ): """Given a sequence of args, return an Instruction object""" ... return Instruction( instrument, size, price, ... ) class Instruction: """encapsulate a single instruction to buy, sell, etc""" def __init__( self, instrument, size, price, ... ): ... This doesn't work yet, but I know with time I'll get there. Question is - is there a module out there that will already handle this approach? Thanks for any suggestions :) Andrew -- http://mail.python.org/mailman/listinfo/python-list
Re: sscanf needed
Uwe Mayer wrote: > Hi, > > I've got a ISO 8601 formatted date-time string which I need to read into a > datetime object. > Is there a shorter way than using regular expressions? Is there a sscanf > function as in C? in addition to the other comments... I like re, because it gives me the most control. See below. import re import datetime class Converter: def __init__( self ): self.isoPattern = re.compile( "(\d\d\d\d)-(\d\d)-(\d\d)[tT ](\d\d):(\d\d):(\d\d)" ) def iso2date( self, isoDateString ): match = self.isoPattern.match( isoDateString ) if not match: raise ValueError( "Not in ISO format: '%s'" % isoDateString ) return datetime.datetime( int(match.group(1)), int(match.group(2)), int(match.group(3)), int(match.group(4)), int(match.group(5)), int(match.group(6)) ) c = Converter() def demo( iso ): try: date = c.iso2date( iso ) print "Input '%s' -> datetime: %s" % ( iso, date ) except ValueError, e: print str(e) demo( "2005-04-21T12:34:56" ) demo( "2005-04-21 12:34:57" ) demo( "2005-04-2 12:34:57" ) -- http://mail.python.org/mailman/listinfo/python-list