[Python-announce] logmerger 0.8.0 released

2023-12-07 Thread Paul McGuire
logmerger 0.8.0 === New features: - Added --inline command line option to view merged logs in a single inline column instead of side-by-side columns (side-by-side is the default) - Added jump feature to move by number of lines or by a time period in microseconds, milliseconds,

[Python-announce] logmerger 0.7.0

2023-10-08 Thread Paul McGuire
logmerger 0.7.0 === Screenshot: https://github.com/ptmcg/logmerger/blob/main/static/log1_log2_merged_tui_lr.jpg?raw=true Use logmerger to view multiple log files, merged side-by-side with a common timeline using timestamps from the input files. - merge ASCII log files - detects

[Python-announce] pyparsing 3.1.1 released

2023-07-30 Thread Paul McGuire
Thanks everyone for the great feedback on the 3.1.0 release! Caught some glaring regressions that slipped through my test suite. Just published version 3.1.1: https://github.com/pyparsing/pyparsing/releases/tag/3.1.1 - Fixed regression in Word(min), reported by Ricardo Coccioli, good catch!

[Python-announce] pyparsing 3.1.0 released

2023-06-18 Thread Paul McGuire
After several alpha and beta releases, I've finally pushed out version 3.1.0 of pyparsing. Here are the highlights: NOTE: In the future release 3.2.0, use of many of the pre-PEP8 methods (such as `ParserElement.parseString`) will start to raise `DeprecationWarnings`. 3.2.0 should get released

[Python-announce] Pyparsing 3.1.0b2 released (final beta!)

2023-05-20 Thread Paul McGuire
I just pushed release 3.1.0b2 of pyparsing. 3.1.0 with some fixes to bugs that came up in the past few weeks - testing works! If your project uses pyparsing, please please *please* download this beta release (using "pip install -U pyparsing==3.1.0b2") and open any compatibility issues you

[Python-announce] Pyparsing 3.1.0b1 released

2023-04-10 Thread Paul McGuire
I just pushed release 3.1.0b1 of pyparsing. 3.1.0 will include support for python 3.12, and will be the last release to support 3.6 and 3.7. If your project uses pyparsing, *please* download this beta release (using "pip install -U pyparsing==3.1.0b1") and open any compatibility issues you

[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire
Paul McGuire added the comment: Patch file attached. -- keywords: +patch Added file: http://bugs.python.org/file44182/ptm_27822.patch ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Paul McGuire
Paul McGuire added the comment: Ok, I will submit as a separate issue. -- ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue27746> ___ __

[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire
Paul McGuire added the comment: (issue applies to both 3.5.2 and 3.6) -- versions: +Python 3.5 ___ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/i

[issue27746] ResourceWarnings in test_asyncio

2016-08-21 Thread Paul McGuire
Paul McGuire added the comment: I was about to report this same issue - I get the error message even though I explicitly call transport.close(): C:\Python35\lib\asyncio\selector_events.py:582: ResourceWarning: unclosed transport <_SelectorDatagramTransport closing fd=232> It look

[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire
Paul McGuire added the comment: To clarify how I'm using a socket without a bound address, I am specifying the destination address in the call to transport.sendto(), so there is no address on the socket itself, hence getsockname() fails

[issue27822] Fail to create _SelectorTransport with unbound socket

2016-08-21 Thread Paul McGuire
New submission from Paul McGuire: In writing a simple UDP client using asyncio, I tripped over a call to getsockname() in the _SelectorTransport class in asyncio/selector_events.py. def __init__(self, loop, sock, protocol, extra=None, server=None): super().__init__(extra, loop

Re: Python re to extract useful information from each line

2015-08-19 Thread Paul McGuire
Here is a first shot at a pyparsing parser for these lines: from pyparsing import * SET,POLICY,ID,FROM,TO,NAT,SRC,DST,IP,PORT,SCHEDULE,LOG,PERMIT,ALLOW,DENY = map(CaselessKeyword, SET,POLICY,ID,FROM,TO,NAT,SRC,DST,IP,PORT,SCHEDULE,LOG,PERMIT,ALLOW,DENY.split(',')) integer = Word(nums)

Re: python command not working

2015-08-17 Thread Paul McGuire
On Friday, August 14, 2015 at 6:13:37 AM UTC-5, sam.h...@gmail.com wrote: On Wednesday, April 22, 2009 at 8:36:21 AM UTC+1, David Cournapeau wrote: On Wed, Apr 22, 2009 at 4:20 PM, 83nini 83n...@gmail.com wrote: Hi guys, I'm new to python, i downloaded version 2.5, opened windows

Who is using littletable?

2015-08-17 Thread Paul McGuire
littletable is a little module I knocked together a few years ago, found it sort of useful, so uploaded to SF and PyPI. The download traffic at SF is very light, as I expected, but PyPI shows 3000 downloads in the past month! Who *are* all these people? In my own continuing self-education,

ANN: pyparsing 2.0.2 released

2014-04-19 Thread Paul McGuire
I'm happy to announce a new release of pyparsing, version 2.0.2. This release contains some small enhancements and some bugfixes. Change summary: --- - Extended expr(name) shortcut (same as expr.setResultsName(name)) to accept expr() as a shortcut for expr.copy(). - Added

[ANN] pyparsing 2.0.1 released - compatible with Python 2.6 and later

2013-07-21 Thread Paul McGuire
in pyparsing! -- Paul McGuire -- http://mail.python.org/mailman/listinfo/python-announce-list Support the Python Software Foundation: http://www.python.org/psf/donations/

[ANN] pyparsing 2.0.1 released - compatible with Python 2.6 and later

2013-07-20 Thread Paul McGuire
in pyparsing! -- Paul McGuire -- http://mail.python.org/mailman/listinfo/python-list

Re: Problem installing Pyparsing

2013-07-20 Thread Paul McGuire
Pyparsing 2.0.1 fixes this incompatibility, and should work with all versions of Python 2.6 and later. -- Paul -- http://mail.python.org/mailman/listinfo/python-list

ANNOUNCE: pyparsing 1.5.7/2.0.0

2012-12-16 Thread Paul McGuire
With the release of version 2.0.0/1.5.7, pyparsing has now officially switched to Python 3.x support as its default installation environment. Python 2.x users can install the latest 1.5.7 release. (If you're using easy_install, do easy_install pyparsing==1.5.7.) I'm taking this opportunity to

ANN: pyparsing 1.5.6 released!

2011-07-01 Thread Paul McGuire
After about 10 months, there is a new release of pyparsing, version 1.5.6. This release contains some small enhancements, some bugfixes, and some new examples. Most notably, this release includes the first public release of the Verilog parser. I have tired of restricting this parser for

[ANN]littletable 0.3 release

2010-10-24 Thread Paul McGuire
Announcing the 0.3 release of littletable (the module formerly known as dulce). The version includes (thanks to much help from Colin McPhail, thanks Colin!): - support for namedtuples as table objects - Python 3 compatibility - Table.pivot() to summarize record counts by 1 or 2 table attributes

ANN: dulce 0.1 - in-memory schema-less relational database

2010-10-17 Thread Paul McGuire
dulce is a syntactic sweet wrapper for managing collections of Python objects like relational tables. No schema definition is used; instead table columns are introspected from the attributes of objects inserted into the table, and inferred from index and query parameters. dulce's Tables can be:

Re: mutate dictionary or list

2010-09-08 Thread Paul McGuire
On Sep 7, 7:05 am, Baba raoul...@gmail.com wrote: Hi I am working on an exercise which requires me to write a funtion that will check if a given word can be found in a given dictionary (the hand). def is_valid_word(word, hand, word_list):         Returns True if word is in the word_list

Re: Tag parsing in python

2010-08-29 Thread Paul McGuire
On Aug 28, 11:23 pm, Paul McGuire pt...@austin.rr.com wrote: On Aug 28, 11:14 am, agnibhu dee...@gmail.com wrote: Hi all, I'm a newbie in python. I'm trying to create a library for parsing certain keywords. For example say I've key words like abc: bcd: cde: like that... So

Re: Tag parsing in python

2010-08-28 Thread Paul McGuire
On Aug 28, 11:14 am, agnibhu dee...@gmail.com wrote: Hi all, I'm a newbie in python. I'm trying to create a library for parsing certain keywords. For example say I've key words like abc: bcd: cde: like that... So the user may use like abc: How are you bcd: I'm fine cde: ok So I've to

Re: Is '[' a function or an operator or an language feature?

2010-07-17 Thread Paul McGuire
On Jul 16, 12:01 pm, Peng Yu pengyu...@gmail.com wrote: I mean to get the man page for '[' like in the following code. x=[1,2,3] But help('[') doesn't seem to give the above usage. ### Mutable Sequence Types ** List objects support additional operations that

Re: nicer way to remove prefix of a string if it exists

2010-07-14 Thread Paul McGuire
On Jul 13, 6:49 pm, News123 news1...@free.fr wrote: I wondered about a potentially nicer way of removing a prefix of a string if it exists. Here is an iterator solution: from itertools import izip def trim_prefix(prefix, s): i1,i2 = iter(prefix),iter(s) if all(c1==c2 for c1,c2 in

Re: The real problem with Python 3 - no business case for conversion (was I strongly dislike Python 3)

2010-07-07 Thread Paul McGuire
On Jul 6, 3:30 am, David Cournapeau courn...@gmail.com wrote: On Tue, Jul 6, 2010 at 4:30 AM, D'Arcy J.M. Cain da...@druid.net wrote: One thing that would be very useful is how to maintain something that works on 2.x and 3.x, but not limiting yourself to 2.6. Giving up versions below 2.6 is

Re: GAE + recursion limit

2010-07-02 Thread Paul McGuire
Does anyone have any clue what that might be? Why the problem is on GAE (even when run locally), when command line run works just fine (even with recursion limit decreased)? Can't explain why you see different behavior on GAE vs. local, but it is unusual for a small translator to flirt with

Re: automate minesweeper with python

2010-06-30 Thread Paul McGuire
On Jun 30, 6:39 pm, Jay jayk...@yahoo.com wrote: I would like to create a python script that plays the Windows game minesweeper. The python code logic and running minesweeper are not problems. However, seeing the 1-8 in the minesweeper map and clicking on squares is. I have no idea how to

[ANN] pyparsing 1.5.3 released

2010-06-25 Thread Paul McGuire
I'm happy to announce that a new release of pyparsing is now available, version 1.5.3. It has been almost a year and a half since 1.5.2 was released, but pyparsing has remained pretty stable. I believe I have cleaned up the botch-job I made in version 1.5.2 of trying to support both Python 2.x

[ANN] pyparsing 1.5.3 released

2010-06-24 Thread Paul McGuire
I'm happy to announce that a new release of pyparsing is now available, version 1.5.3. It has been almost a year and a half since 1.5.2 was released, but pyparsing has remained pretty stable. I believe I have cleaned up the botch-job I made in version 1.5.2 of trying to support both Python 2.x

Need some Python 3 help

2010-05-25 Thread Paul McGuire
I was teetering on the brink of releasing Pyparsing 1.5.3 (with some nice new examples and goodies), when I saw that I had recently introduced a bug in the Python 3 compatible version. Here is the stacktrace as reported on SF: Traceback (most recent call last): File testcase.py, line 11, in

Re: Need some Python 3 help

2010-05-25 Thread Paul McGuire
On May 25, 8:58 pm, Benjamin Peterson benja...@python.org wrote: Paul McGuire ptmcg at austin.rr.com writes: In this section of code, instring is a string, loc is an int, and wt is a string.  Any clues why instring[loc] would be evaluating as int? (I am unfortunately dependent

condition and True or False

2010-05-02 Thread Paul McGuire
While sifting through some code looking for old x and y or z code that might better be coded using y if x else z, I came across this puzzler: x = boolean expression and True or False What is and True or False adding to this picture? The boolean expression part is already evaluating to a

Re: Usable street address parser in Python?

2010-04-19 Thread Paul McGuire
On Apr 17, 2:23 pm, John Nagle na...@animats.com wrote:    Is there a usable street address parser available?  There are some bad ones out there, but nothing good that I've found other than commercial products with large databases.  I don't need 100% accuracy, but I'd like to be able to

Re: Confused by slash/escape in regexp

2010-04-11 Thread Paul McGuire
On Apr 11, 5:43 pm, andrew cooke and...@acooke.org wrote: Is the third case here surprising to anyone else?  It doesn't make sense to me... Python 2.6.2 (r262:71600, Oct 24 2009, 03:15:21) [GCC 4.4.1 [gcc-4_4-branch revision 150839]] on linux2 Type help, copyright, credits or license for

Re: Tough sorting problem: or, I'm confusing myself

2010-04-11 Thread Paul McGuire
On Apr 9, 10:03 am, david jensen dmj@gmail.com wrote: Hi all, I'm trying to find a good way of doing the following: Each n-tuple in combinations( range( 2 ** m ), n ) has a corresponding value n-tuple (call them scores for clarity later). I'm currently storing them in a dictionary, by

Re: Python and Regular Expressions

2010-04-10 Thread Paul McGuire
On Apr 10, 8:38 pm, Paul Rubin no.em...@nospam.invalid wrote: The impression that I have (from a distance) is that Pyparsing is a good interface abstraction with a kludgy and slow implementation.  That the implementation uses regexps just goes to show how kludgy it is.  One hopes that someday

Re: Dynamically growing an array to implement a stack

2010-04-08 Thread Paul McGuire
On Apr 8, 3:21 pm, M. Hamed mhels...@hotmail.com wrote: I have trouble with some Python concept. The fact that you can not assign to a non-existent index in an array. For example: a = [0,1] a[2] = Generates an error I can use a.append(2) but that always appends to the end. Sometimes

Re: Recommend Commercial graphing library

2010-04-06 Thread Paul McGuire
On Apr 6, 11:05 am, AlienBaby matt.j.war...@gmail.com wrote: The requirement for a commercial license comes down to being restricted to not using any open source code. If it's an open source license it can't be used in our context. You may be misunderstanding this issue, I think you are

Re: s-expression parser in python

2010-04-06 Thread Paul McGuire
On Apr 6, 7:02 pm, James Stroud nospamjstroudmap...@mbi.ucla.edu wrote: Hello All, I want to use an s-expression based configuration file format for a python program I'm writing. Does anyone have a favorite parser? The pyparsing wiki includes this parser on its Examples page:

Re: vars().has_key() question about how working .

2010-04-04 Thread Paul McGuire
On Apr 4, 3:42 am, catalinf...@gmail.com catalinf...@gmail.com wrote: Hi everyone . My questions is why vars().has_key('b') is False ?' I expecting to see True because is a variable ... Thanks Yes, 'b' is a var, but only within the scope of something(). See how this is different: def

Re: C-style static variables in Python?

2010-04-02 Thread Paul McGuire
On Apr 1, 5:34 pm, kj no.em...@please.post wrote: When coding C I have often found static local variables useful for doing once-only run-time initializations.  For example: Here is a decorator to make a function self-aware, giving it a this variable that points to itself, which you could then

Re: Generating text from a regular expression

2010-03-31 Thread Paul McGuire
On Mar 31, 5:49 am, Nathan Harmston iwanttobeabad...@googlemail.com wrote: Hi everyone, I have a slightly complicated/medium sized regular expression and I want to generate all possible words that it can match (to compare performance of regex against an acora based matcher). The pyparsing

Re: file seek is slow

2010-03-09 Thread Paul McGuire
This is a pretty tight loop: for i in xrange(100): f1.seek(0) But there is still a lot going on, some of which you can lift out of the loop. The easiest I can think of is the lookup of the 'seek' attribute on the f1 object. Try this: f1_seek = f1.seek for i in xrange(100):

Re: Problem with regular expression

2010-03-07 Thread Paul McGuire
On Mar 7, 4:32 am, Joan Miller pelok...@gmail.com wrote: I would to convert the first string to upper case. But this regular expression is not matching the first string between quotes. Is using pyparsing overkill? Probably. But your time is valuable, and pyparsing let's you knock this out in

Re: How to efficiently extract information from structured text file

2010-02-18 Thread Paul McGuire
On Feb 17, 7:38 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Wed, 17 Feb 2010 17:13:23 -0800, Jonathan Gardner wrote: And once you realize that every program is really a compiler, then you have truly mastered the Zen of Programming in Any Programming Language That

Re: How to efficiently extract information from structured text file

2010-02-17 Thread Paul McGuire
On Feb 16, 5:48 pm, Imaginationworks xiaju...@gmail.com wrote: Hi, I am trying to read object information from a text file (approx. 30,000 lines) with the following format, each line corresponds to a line in the text file.  Currently, the whole file was read into a string list using

Re: pyparsing wrong output

2010-02-12 Thread Paul McGuire
On Feb 12, 6:41 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Fri, 12 Feb 2010 10:41:40 -0300, Eknath Venkataramani   eknath.i...@gmail.com escribió: I am trying to write a parser in pyparsing. Help Me.http://paste.pocoo.org/show/177078/is the code and this is   input

Re: How to measure elapsed time under Windows?

2010-02-10 Thread Paul McGuire
On Feb 10, 2:24 am, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Tue, 9 Feb 2010 21:45:38 + (UTC), Grant Edwards inva...@invalid.invalid declaimed the following in gmane.comp.python.general: Doesn't work.  datetime.datetime.now has granularity of 15-16ms. Intervals much less

Re: How to measure elapsed time under Windows?

2010-02-09 Thread Paul McGuire
On Feb 9, 10:10 am, Grant Edwards inva...@invalid.invalid wrote: Is there another way to measure small periods of elapsed time (say in the 1-10ms range)? On Feb 9, 10:10 am, Grant Edwards inva...@invalid.invalid wrote: Is there another way to measure small periods of elapsed time (say in the

Re: How to print all expressions that match a regular expression

2010-02-07 Thread Paul McGuire
On Feb 6, 1:36 pm, hzh...@gmail.com hzh...@gmail.com wrote: Hi, I am a fresh man with python. I know there is regular expressions in Python. What I need is that given a particular regular expression, output all the matches. For example, given “[1|2|3]{2}” as the regular expression, the

Re: parsing an Excel formula with the re module

2010-01-14 Thread Paul McGuire
I never represented that this parser would handle any and all Excel formulas! But I should hope the basic structure of a pyparsing solution might help the OP add some of the other features you cited, if necessary. It's actually pretty common to take an incremental approach in making such a

Re: parsing an Excel formula with the re module

2010-01-13 Thread Paul McGuire
On Jan 5, 1:49 pm, Tim Chase python.l...@tim.thechases.com wrote: vsoler wrote: Hence, I need toparseExcel formulas. Can I do it by means only of re (regular expressions)? I know that for simple formulas such as =3*A7+5 it is indeed possible. What about complex for formulas that include

Re: Regex help needed!

2009-12-22 Thread Paul McGuire
On Dec 21, 5:38 am, Oltmans rolf.oltm...@gmail.com wrote: Hello,. everyone. I've a string that looks something like lksjdfls div id ='amazon_345343' kdjff lsdfs /div sdjfls div id =   amazon_35343433sdfsd/divdiv id='amazon_8898'welcome/div From above string I need the digits

Re: How to create a docstring for a module?

2009-12-06 Thread Paul McGuire
On Dec 6, 7:43 am, Steven D'Aprano st...@remove-this- cybersource.com.au wrote: On Sun, 06 Dec 2009 06:34:17 -0600, Tim Chase wrote: I've occasionally wanted something like this, and have found that it can be done by manually assigning to __doc__ (either at the module-level or classes)

Re: trouble with regex?

2009-10-08 Thread Paul McGuire
On Oct 8, 11:42 am, MRAB pyt...@mrabarnett.plus.com wrote: inhahe wrote: Can someone tell me why this doesn't work? colorre = re.compile ('('                         '^'                        '|'                         '(?:'                            

Re: bug with itertools.groupby?

2009-10-07 Thread Paul McGuire
On Oct 6, 6:06 pm, Kitlbast vlad.shevche...@gmail.com wrote: grouped acc:  61 grouped acc:  64 grouped acc:  61 am I doing something wrong? sort first, then groupby. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular expression to structure HTML

2009-10-02 Thread Paul McGuire
On Oct 2, 12:10 am, 504cr...@gmail.com 504cr...@gmail.com wrote: I'm kind of new to regular expressions, and I've spent hours trying to finesse a regular expression to build a substitution. What I'd like to do is extract data elements from HTML and structure them so that they can more readily

Re: Are min() and max() thread-safe?

2009-09-17 Thread Paul McGuire
On Sep 16, 11:33 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I have two threads, one running min() and the other running max() over the same list. I'm getting some mysterious results which I'm having trouble debugging. Are min() and max() thread-safe, or am I doing

Re: Retrieve url's of all jpegs at a web page URL

2009-09-15 Thread Paul McGuire
On Sep 15, 11:32 pm, Stefan Behnel stefan...@behnel.de wrote: Also untested:         from lxml import html         doc = html.parse(page_url)         doc.make_links_absolute(page_url)         urls = [ img.src for img in doc.xpath('//img') ] Then use e.g. urllib2 to save the images.

Re: Where regexs listed for Python language's tokenizer/lexer?

2009-09-12 Thread Paul McGuire
On Sep 12, 1:10 am, Chris Seberino cseber...@gmail.com wrote: Where regexs listed for Python language's tokenizer/lexer? If I'm not mistaken, the grammar is not sufficient to specify the language you also need to specify the regexs that define the tokens right?..where is that? I think

Re: Something confusing about non-greedy reg exp match

2009-09-07 Thread Paul McGuire
On Sep 6, 11:23 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: George Burdell gburde...@gmail.com writes: I want to find every occurrence of money, and for each occurrence, I want to scan back to the first occurrence of hello. How can this be done? By recognising the task: not

Re: Smallest float different from 0.0?

2009-09-07 Thread Paul McGuire
On Sep 7, 9:47 am, kj no.em...@please.post wrote: Is there some standardized way (e.g. some official module of such limit constants) to get the smallest positive float that Python will regard as distinct from 0.0? TIA! kj You could find it for yourself: for i in range(400): ...if

Re: Creating slice notation from string

2009-09-02 Thread Paul McGuire
On Sep 2, 4:55 pm, bvdp b...@mellowood.ca wrote: I'm trying to NOT create a parser to do this and I'm sure that it's easy if I could only see the light! Well, this is a nice puzzler, better than a sudoku. Maybe a quick parser with pyparsing will give you some guidance on how to do this

Re: Is behavior of += intentional for int?

2009-08-30 Thread Paul McGuire
On Aug 30, 2:33 am, Derek Martin c...@pizzashack.org wrote: THAT is why Python's behavior with regard to numerical objects is not intuitive, and frankly bizzare to me, and I dare say to others who find it so. Yes, that's right.  BIZZARE. Can't we all just get along? I think the question

Re: Is behavior of += intentional for int?

2009-08-30 Thread Paul McGuire
On Aug 30, 5:42 am, Paul McGuire pt...@austin.rr.com wrote: Python binds values to names. Always. In Python, = is not and never could be a class operator.  In Python, any expression of LHS = RHS, LHS is always a name, and in this statement it is being bound to some object found by evaluating

Re: Is behavior of += intentional for int?

2009-08-29 Thread Paul McGuire
On Aug 29, 7:45 am, zaur szp...@gmail.com wrote: Python 2.6.2 (r262:71600, Apr 16 2009, 09:17:39) [GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin Type copyright, credits or license() for more information. a=1 x=[a] id(a)==id(x[0]) True a+=1 a 2 x[0] 1 I thought that +=

Re: regexp help

2009-08-27 Thread Paul McGuire
On Aug 27, 1:15 pm, Bakes ba...@ymail.com wrote: If I were using the code: (?Pdata[0-9]+) to get an integer between 0 and 9, how would I allow it to register negative integers as well? With that + sign in there, you will actually get an integer from 0 to 9... -- Paul --

Re: python fast HTML data extraction library

2009-07-22 Thread Paul McGuire
On Jul 22, 5:43 pm, Filip pink...@gmail.com wrote: My library, rather than parsing the whole input into a tree, processes it like a char stream with regular expressions. Filip - In general, parsing HTML with re's is fraught with easily-overlooked deviations from the norm. But since you have

Re: Override a method but inherit the docstring

2009-07-16 Thread Paul McGuire
On Jul 16, 8:01 pm, Ben Finney ben+pyt...@benfinney.id.au wrote: Howdy all, The following is a common idiom::     class FooGonk(object):         def frobnicate(self):             Frobnicate this gonk.             basic_implementation(self.wobble)     class BarGonk(FooGonk):        

Re: c++ Source Code for acm 2004-2005 problems

2009-07-12 Thread Paul McGuire
On Jul 12, 5:24 pm, Davood Vahdati davoodvahdati2...@gmail.com wrote: Dear Sirs And Madams : it is an Acm programming competition Questions in year 2004-2005 . could you please solve problems is question ? I  Wan't C++ Source Code program About this questions OR Problems . thank you for your

Re: Examples of Python driven Microsoft UI Automation wanted

2009-07-09 Thread Paul McGuire
On Jul 9, 1:09 pm, DuaneKaufman duane.kauf...@gmail.com wrote: The application I wish to interact with is not my own, but an ERP system GUI front-end. I have used pywinauto to drive a Flash game running inside of an Internet Explorer browser - that's pretty GUI! -- Paul --

Re: parsing times like 5 minutes ago?

2009-07-07 Thread Paul McGuire
On Jul 6, 7:21 pm, m...@pixar.com wrote: I'm looking for something like Tcl's [clock scan] command which parses human-readable time strings such as:     % clock scan 5 minutes ago     1246925569     % clock scan tomorrow 12:00     1246993200     % clock scan today + 1 fortnight    

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-05 Thread Paul McGuire
On Jul 5, 3:12 am, Hendrik van Rooyen m...@microcorp.co.za wrote: Use a dispatch dict, and have each state return the next state. Then you can use strings representing state names, and everybody will be able to understand the code. toy example, not tested, nor completed: protocol =

Re: How to insert string in each match using RegEx iterator

2009-06-10 Thread Paul McGuire
On Jun 9, 11:13 pm, 504cr...@gmail.com 504cr...@gmail.com wrote: By what method would a string be inserted at each instance of a RegEx match? Some might say that using a parsing library for this problem is overkill, but let me just put this out there as another data point for you. Pyparsing

Re: random number including 1 - i.e. [0,1]

2009-06-10 Thread Paul McGuire
On Jun 9, 11:23 pm, Esmail ebo...@hotmail.com wrote: Here is part of the specification of an algorithm I'm implementing that shows the reason for my original query: vid = w * vid + c1 * rand( ) * ( pid – xid ) + c2 * Rand( ) * (pgd –xid ) (1a) xid = xid + vid (1b) where c1 and c2 are two

Re: random number including 1 - i.e. [0,1]

2009-06-09 Thread Paul McGuire
On Jun 9, 4:33 pm, Esmail ebo...@hotmail.com wrote: Hi, random.random() will generate a random value in the range [0, 1). Is there an easy way to generate random values in the range [0, 1]? I.e., including 1? Are you trying to generate a number in the range [0,n] by multiplying a random

Re: networking simulator on python

2009-06-08 Thread Paul McGuire
On Jun 8, 7:18 pm, Ala shaib...@ymail.com wrote: Hello everyone. I plan on starting to write a network simulator on python for testing a modified version of TCP. I am wondering if a python network simulator exists? Also, if anyone tried using simpy for doing a simulation. Thank you There

Re: I need help building a data structure for a state diagram

2009-05-25 Thread Paul McGuire
On May 24, 1:16 pm, Matthew Wilson m...@tplus1.com wrote: I'm working on a really simple workflow for my bug tracker.  I want filed bugs to start in an UNSTARTED status.  From there, they can go to STARTED. I just wrote an article for the April issue of Python Magazine on how to add embedded

Re: slice iterator?

2009-05-08 Thread Paul McGuire
On May 8, 11:14 pm, Ned Deily n...@acm.org wrote: In article 7xprejoswg@ruckus.brouhaha.com,  Paul Rubin http://phr...@nospam.invalid wrote: Ross ross.j...@gmail.com writes: I have a really long list that I would like segmented into smaller lists. Let's say I had a list a =

Re: string processing question

2009-04-30 Thread Paul McGuire
On Apr 30, 11:55 am, Kurt Mueller m...@problemlos.ch wrote: Hi, on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 python -c 'a=ä; print a ; print a.center(6,-) ; b=unicode(a, utf8); print b.center(6,-)' ä --ä-- --ä--- Weird. What

Re: if statement, with function inside it: if (t = Test()) == True:

2009-04-24 Thread Paul McGuire
On Apr 24, 5:00 am, GC-Martijn gcmart...@gmail.com wrote: Hello, I'm trying to do a if statement with a function inside it. I want to use that variable inside that if loop , without defining it. def Test():     return 'Vla' I searching something like this: if (t = Test()) == 'Vla':    

ANN: pyparsing 1.5.2 released!

2009-04-20 Thread Paul McGuire
Well, it has been about 6 months since the release of pyparsing 1.5.1, and there have been no new functional enhancements to pyparsing. I take this as a further sign that pyparsing is reaching a development/ maturity plateau. With the help of the pyparsing community, there are some compatibility

ANN: pyparsing 1.5.2 released!

2009-04-20 Thread Paul McGuire
Well, it has been about 6 months since the release of pyparsing 1.5.1, and there have been no new functional enhancements to pyparsing. I take this as a further sign that pyparsing is reaching a development/ maturity plateau. With the help of the pyparsing community, there are some compatibility

Re: Help improve program for parsing simple rules

2009-04-17 Thread Paul McGuire
On Apr 16, 10:57 am, prueba...@latinmail.com wrote: Another interesting task for those that are looking for some interesting problem: I inherited some rule system that checks for programmers program outputs that to be ported: given some simple rules and the values it has to determine if the

Re: Help improve program for parsing simple rules

2009-04-17 Thread Paul McGuire
On Apr 17, 10:43 am, John Machin sjmac...@lexicon.net wrote: I don't see how it can handle the chained relop in the last two testcases e. g. '0.00 LE A LE 4.00' -- unless relops are chained by default in your parser. John - First of all, to respect precedence of operations, higher level

Re: Help improve program for parsing simple rules

2009-04-17 Thread Paul McGuire
On Apr 17, 1:26 pm, Aaron Brady castiro...@gmail.com wrote: Hi, not to offend; I don't know your background.   Courtesy on Usenet!!! I'm going to go buy a lottery ticket! Not to worry, I'm a big boy. People have even called my baby ugly, and I manage to keep my blood pressure under control.

Re: question about xrange performance

2009-04-17 Thread Paul McGuire
On Apr 17, 1:39 pm, _wolf wolfgang.l...@gmail.com wrote: can it be that a simple diy-class outperforms a python built-in by a factor of 180? is there something i have done the wrong way? omissions, oversights? do other people get similar figures? cheers I wouldn't say you are outperforming

Re: Help improve program for parsing simple rules

2009-04-17 Thread Paul McGuire
On Apr 17, 2:40 pm, prueba...@latinmail.com wrote: On Apr 17, 11:26 am, Paul McGuire pt...@austin.rr.com wrote: On Apr 16, 10:57 am, prueba...@latinmail.com wrote: Another interesting task for those that are looking for some interesting problem: I inherited some rule system

Re: regex alternation problem

2009-04-17 Thread Paul McGuire
On Apr 17, 4:49 pm, Jesse Aldridge jessealdri...@gmail.com wrote: import re s1 = I am an american s2 = I am american an for s in [s1, s2]:     print re.findall( (am|an) , s) # Results: # ['am'] # ['am', 'an'] --- I want the results to be the same for each string.  What am I

Re: regex alternation problem

2009-04-17 Thread Paul McGuire
On Apr 17, 5:28 pm, Paul McGuire pt...@austin.rr.com wrote: -- Paul Your find pattern includes (and consumes) a leading AND trailing space around each word.  In the first string I am an american, there is a leading and trailing space around am, but the trailing space for am is the leading

Re: Automatically generating arithmetic operations for a subclass

2009-04-14 Thread Paul McGuire
On Apr 14, 4:09 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I have a subclass of int where I want all the standard arithmetic operators to return my subclass, but with no other differences: class MyInt(int):     def __add__(self, other):         return

Re: safe eval of moderately simple math expressions

2009-04-11 Thread Paul McGuire
On Apr 11, 2:41 am, Aaron Brady castiro...@gmail.com wrote: Why do I get the feeling that the authors of 'pyparsing' are out of breath? What kind of breathlessness do you mean? I'm still breathing, last time I checked. The-rumors-of-my-demise-have-been-greatly-exaggerated'ly yours, -- Paul

Re: safe eval of moderately simple math expressions

2009-04-09 Thread Paul McGuire
On Apr 9, 10:56 am, Joel Hedlund joel.hedl...@gmail.com wrote: Hi all! I'm writing a program that presents a lot of numbers to the user, and I want to let the user apply moderately simple arithmentics to these numbers. Joel - Take a look at the examples page on the pyparsing wiki (http://

Re: Best way to extract from regex in if statement

2009-04-04 Thread Paul McGuire
On Apr 3, 9:26 pm, Paul Rubin http://phr...@nospam.invalid wrote: bwgoudey bwgou...@gmail.com writes: elif re.match(^DATASET:\s*(.+) , line):         m=re.match(^DATASET:\s*(.+) , line)         print m.group(1)) Sometimes I like to make a special class that saves the result:   class

Re: python needs leaning stuff from other language

2009-04-04 Thread Paul McGuire
On Apr 3, 11:48 pm, Tim Wintle tim.win...@teamrubber.com wrote: del mylist[:] * or * mylist[:] = [] * or * mylist = [] which, although semantically similar are different as far as the interpreter are concerned (since two of them create a new list): Only the last item creates a new list

Re: List of paths

2009-04-01 Thread Paul McGuire
On Apr 1, 3:57 am, Nico Grubert nicogrub...@gmail.com wrote: Dear Python developers I have the following (sorted) list. ['/notebook',   '/notebook/mac',   '/notebook/mac/macbook',   '/notebook/mac/macbookpro',   '/notebook/pc',   '/notebook/pc/lenovo',   '/notebook/pc/hp',  

  1   2   3   4   5   6   7   8   9   10   >