[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-31 Thread Jesús Cea Avión
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13899 ___ ___ Python-bugs-list mailing list

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: r'[\w]' also matches word chars. I find that a very useful property, since you can easily build classes like '[\w.]' It's also impossible to change this without breaking lots of regexes. It's also explicitly documented, although IMO it's not

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: [\w] should definitely work, but [\B] doesn't seem to match anything useful, and it just fails silently because it's neither equivalent to \B nor to [B]: re.match(r'foo\B', 'foobar') # on a non-word-boundary -- matches fine _sre.SRE_Match

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Interesting. That shifts the issue, since the current behavior is neither of the two that make sense. Then it would indeed make the most sense to raise in these cases. (I wonder what these patterns actually would match, but I have no time to

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread John Machin
John Machin sjmac...@lexicon.net added the comment: @Ezio: Comparison of the behaviour of \letter inside/outside character classes is irrelevant. The rules for inside can be expressed simply as: 1. Letters dDsSwW are special; they represent categories as documented, and do in fact have a

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-29 Thread John Machin
John Machin sjmac...@lexicon.net added the comment: Whoops: normal Python rules for backslash escapes should have had a note but revert to the C behaviour of stripping the \ from unrecognised escapes which is what re appears to do in its own \ handling. --

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-28 Thread John Machin
at runtime; the switch default has a comment to the effect that nothing can be done, so pretend that the unknown opcode matched nothing. Zen? -- messages: 152194 nosy: sjmachin priority: normal severity: normal status: open title: re pattern r[\A] should work like A but matches nothing

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-28 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: This happens because \A, \B and \Z are valid escape sequences[0]. If what you mean is that they shouldn't be recognized as such inside a character class, then I can agree with that. ^ and $ are similar to \A and \Z but they are considered

[issue13899] re pattern r[\A] should work like A but matches nothing. Ditto B and Z.

2012-01-28 Thread John Machin
John Machin sjmac...@lexicon.net added the comment: @ezio: Of course the context is inside a character class. I expect r'[\b]' to act like r'\b' aka r'\x08' aka backspace because (1) that is the treatment applied to all other C-like control char escapes (2) the docs say so explicitly: Inside

share a apache pattern log parser

2012-01-06 Thread 罗晟
a little apache pattern server log parser apache_log_parser to share with you at https://github.com/happy15/apache_log_parser Hope you like it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Ulrich Eckhardt
Am 04.11.2011 01:33, schrieb Anthony Kong: I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? My consensus with myself is that design patterns are language-agnostic. If I write class Foo serves as view and controller

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread John Roth
On Nov 3, 6:33 pm, Anthony Kong anthony.hw.k...@gmail.com wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Joe Riopel
On Fri, Nov 4, 2011 at 8:28 AM, John Roth johnro...@gmail.com wrote: The first is that if you use TDD (Test Driven Development) and refactor relentlessly to remove duplication, most of the basic design patterns will emerge naturally from the code as you work. I agree, and there is a pretty

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Andrea Crotti
On 11/04/2011 12:33 AM, Anthony Kong wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some 'fact-finding' in this area

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Terry Reedy
On 11/4/2011 8:46 AM, Andrea Crotti wrote: Well this book is work in progress Though not touched since May 2009 https://bitbucket.org/BruceEckel/python-3-patterns-idioms/src but it actually looks very interesting The slightly older .pdf version is a bit bizarre as parts of both text and

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-04 Thread Ned Deily
Search for presentations and videos by Alex Martelli. He's the goto (so to speak) person on Python design patterns. Here, for instance: http://code.google.com/edu/languages/#_python_patterns -- Ned Deily, n...@acm.org -- http://mail.python.org/mailman/listinfo/python-list

Design Pattern and Python: Any book recommendation? Your view?

2011-11-03 Thread Anthony Kong
Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I am doing some 'fact-finding' in this area on request of my colleagues. Some of them

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-03 Thread Roy Smith
is the current prevailing view or consensus (if any) on the use of Design Pattern in python? [...] I myself pretty much subscribe to the view that the nature of python language actually do away much of the need of the use of DP To a certain extent, I agree. I don't have a huge amount of experience

Re: Design Pattern and Python: Any book recommendation? Your view?

2011-11-03 Thread Chris Rebert
On Thu, Nov 3, 2011 at 5:33 PM, Anthony Kong anthony.hw.k...@gmail.com wrote: Sorry to resurrect this topic. By google search the last discussion was in 2003. I would like to find out what is the current prevailing view or consensus (if any) on the use of Design Pattern in python? I can

[issue11218] pattern=None when following documentation for load_tests and unittest.main()

2011-06-14 Thread Éric Araujo
Changes by Éric Araujo mer...@netwok.org: -- assignee: docs@python - components: -Documentation nosy: +eric.araujo, ezio.melotti, michael.foord -docs@python stage: - test needed type: feature request - behavior versions: +Python 3.2, Python 3.3

[issue11218] pattern=None when following documentation for load_tests and unittest.main()

2011-06-14 Thread Michael Foord
Changes by Michael Foord mich...@voidspace.org.uk: -- assignee: - michael.foord ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11218 ___ ___

[issue12099] re pattern objects have no __class__

2011-05-17 Thread Michael Foord
. -- messages: 136193 nosy: michael.foord priority: normal severity: normal stage: test needed status: open title: re pattern objects have no __class__ type: behavior versions: Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12099

[issue12099] re pattern objects have no __class__

2011-05-17 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset c9df95b57af3 by Benjamin Peterson in branch '2.7': stop using the old brain-dead interface for providing attributes/methods http://hg.python.org/cpython/rev/c9df95b57af3 -- nosy: +python-dev resolution: - fixed stage: test

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-03-11 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset 06cca90ff105 by orsenthil in branch 'default': Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex http://hg.python.org/cpython/rev/06cca90ff105 -- nosy: +python-dev

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-03-11 Thread Roundup Robot
Roundup Robot devnull@devnull added the comment: New changeset d676601fee6f by Senthil Kumaran in branch '3.1': Fix issue11283 - Clarifying a re pattern in the re module docs for conditional regex http://hg.python.org/cpython/rev/d676601fee6f

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-03-11 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: Okay, fixed in all relevant branches. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-28 Thread Senthil Kumaran
Senthil Kumaran orsent...@gmail.com added the comment: Thinking about the regex pattern again. The example given is not really wrong. It does what it claims to match, that is 'u...@example.com' and 'u...@example.com' and reject u...@example.com' kind of string. Nothing is said about 'u

Re: [issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-27 Thread Senthil Kumaran
On Tue, Feb 22, 2011 at 08:48:20AM +, wesley chun wrote: The fix is to add the end char '$' to the regex to get all 4 working: Better would be a regex for white-space '\s' which would achieve the same purpose plus it would satisfy the other requirement for using it with search and can do

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-25 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- nosy: +pitrou stage: - patch review versions: -Python 2.5, Python 2.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11283 ___

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-25 Thread wesley chun
wesley chun wes...@gmail.com added the comment: i wanted to add one additional comment that it would be nice to have a regex that works with search() (in addition to match()) because such an email address may appear in the middle of a line, say a From: or To: email header. the fix of using a

Re: pattern matching

2011-02-24 Thread John S
On Feb 23, 9:11 pm, monkeys paw mon...@joemoney.net wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('\d\d\/') f =

Re: pattern matching

2011-02-24 Thread Jon Clements
On Feb 24, 2:11 am, monkeys paw mon...@joemoney.net wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('\d\d\/') f =

pattern matching

2011-02-23 Thread monkeys paw
if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('\d\d\/') f = open('test.html') # This file contains the html dates for line in

Re: pattern matching

2011-02-23 Thread Roy Smith
In article kaidnysdesvyi_jqnz2dnuvz_qgdn...@insightbb.com, monkeys paw mon...@joemoney.net wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import

Re: pattern matching

2011-02-23 Thread Steven D'Aprano
On Wed, 23 Feb 2011 21:11:53 -0500, monkeys paw wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? data = 'td01/12/2011/td' # Throw away tags. data = data[4:-5] #

Re: pattern matching

2011-02-23 Thread Chris Rebert
On Wed, Feb 23, 2011 at 6:37 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Wed, 23 Feb 2011 21:11:53 -0500, monkeys paw wrote: if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat

Re: pattern matching

2011-02-23 Thread Roy Smith
statement, however. If you're trying to parse HTML, use an HTML parser. Using a regex like this is perfectly fine for parsing the CDATA text inside the HTML td element, but pattern matching the HTML markup itself is madness. -- http://mail.python.org/mailman/listinfo/python-list

Re: pattern matching

2011-02-23 Thread Dr Vangel
if I have a string such as 'td01/12/2011/td' and i want to reformat it as '20110112', how do i pull out the components of the string and reformat them into a DDMM format? I have: import re test = re.compile('dd/') f = open('test.html') # This file contains the html dates for line in f:

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-22 Thread wesley chun
New submission from wesley chun wes...@gmail.com: In the re docs, it states the following for the conditional regular expression syntax: (?(id/name)yes-pattern|no-pattern) Will try to match with yes-pattern if the group with given id or name exists, and with no-pattern if it doesn’t

[issue11283] incorrect pattern in the re module docs for conditional regex

2011-02-22 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11283 ___ ___

[issue11218] pattern=None when following documentation for load_tests and unittest.main()

2011-02-15 Thread Martin von Gagern
New submission from Martin von Gagern martin.vgag...@gmx.net: If I follow the documentation at http://docs.python.org/library/unittest.html#unittest.main by putting the following two snippets of code in my module file: def load_tests(loader, standard_tests, pattern='test*.py'): # top

Help regarding pattern matching

2010-12-15 Thread jupiter
Hi People, I need some ideas on how to find pattern in random data series like stock chart. What I want is to be able to find Head Shoulder pattern in chart. Thanx Anil -- http://mail.python.org/mailman/listinfo/python-list

Re: Help regarding pattern matching

2010-12-15 Thread Katie T
On Wed, Dec 15, 2010 at 9:21 PM, jupiter anil.jupit...@gmail.com wrote: Hi People, I need some ideas on how to find pattern in random data series like stock chart. What I want is to be able to find Head Shoulder pattern in chart. Have a look at the references in: http://www.dpem.tuc.gr

Re: Help regarding pattern matching

2010-12-15 Thread Chris Rebert
On Wed, Dec 15, 2010 at 6:22 PM, Katie T ka...@coderstack.co.uk wrote: On Wed, Dec 15, 2010 at 9:21 PM, jupiter anil.jupit...@gmail.com wrote: Hi People, I need some ideas on how to find pattern in random data series like stock chart. What I want is to be able to find Head Shoulder

Re: Help regarding pattern matching

2010-12-15 Thread Katie T
On Thu, Dec 16, 2010 at 2:34 AM, Chris Rebert c...@rebertia.com wrote: On Wed, Dec 15, 2010 at 6:22 PM, Katie T ka...@coderstack.co.uk wrote: On Wed, Dec 15, 2010 at 9:21 PM, jupiter anil.jupit...@gmail.com wrote: Hi People, I need some ideas on how to find pattern in random data series like

Combing Medusa's Hair... (Design Pattern)

2010-12-14 Thread kirby.ur...@gmail.com
of implementing this. Mono isn't that different right? In this design pattern, you have something like a dry cleaner's, where people submit jobs at the counter, and go away right away with a ticket (Python returns -- but keeps running). When they come back is more up to them. Work has been done

Re: Combing Medusa's Hair... (Design Pattern)

2010-12-14 Thread Kushal Kumaran
the Python interpreter, which lives as its own process.  The VMs have various ways of implementing this.  Mono isn't that different right? In this design pattern, you have something like a dry cleaner's, where people submit jobs at the counter, and go away right away with a ticket (Python

Re: Combing Medusa's Hair... (Design Pattern)

2010-12-14 Thread kirby urner
On Tue, Dec 14, 2010 at 8:10 PM, Kushal Kumaran kushal.kumaran+pyt...@gmail.com wrote: snip In this design pattern, you have something like a dry cleaner's, where people submit jobs at the counter, and go away right away with a ticket (Python returns -- but keeps running).  When they come

Re: win32 design pattern: COM localserver?

2010-12-09 Thread Mark Hammond
If you are implementing a COM object using win32com, then Python will never be unloaded from the host process, which works in your favour. Just have the COM object use a thread and a queue for this processing. The 'report' method would just stick the params and filenames in the queue and

win32 design pattern: COM localserver?

2010-12-08 Thread kirby.ur...@gmail.com
Greetings gurus. I'm faced with the challenge of having a single-threaded proprietary Win32 language wanting to do multiple calls against a Python COM object. Something like... loObj = CREATEOBJECT(map_maker) loObj.report( params, filename) do while .True. yadda yadda enddo RETURN I.e. the

Re: Regarding searching directory and to delete it with specific pattern.

2010-12-01 Thread MRAB
On 01/12/2010 07:07, Ramprakash Jelari thinakaran wrote: Hi all, Would like to search list of directories with specific pattern and delete it?.. How can i do it?. Example: in /home/jpr/ i have the following list of directories. 1.2.3-2, 1.2.3-10, 1.2.3-8, i would like to delete the directories

Regarding searching directory and to delete it with specific pattern.

2010-11-30 Thread Ramprakash Jelari thinakaran
Hi all, Would like to search list of directories with specific pattern and delete it?.. How can i do it?. Example: in /home/jpr/ i have the following list of directories. 1.2.3-2, 1.2.3-10, 1.2.3-8, i would like to delete the directories other than 1.2.3-10 which is the higher value?.. Regards

[issue10283] New parameter for an NNTP newsgroup pattern in LIST ACTIVE

2010-11-04 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: That's a fine addition, I've committed it in r86177. -- resolution: - fixed stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

[issue10283] New parameter for an NNTP newsgroup pattern in LIST ACTIVE

2010-11-01 Thread Julien ÉLIE
New submission from Julien ÉLIE jul...@trigofacile.com: NNTP.list(*, file=None) Couldn't a grouppattern argument be added? LIST ACTIVE handles a newsgroup pattern (and it would then answer less groups -- also useful for the test suite of nntplib) Something like that: --- nntplib.py.OLD

[issue10283] New parameter for an NNTP newsgroup pattern in LIST ACTIVE

2010-11-01 Thread R. David Murray
Changes by R. David Murray rdmur...@bitdance.com: -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10283 ___ ___ Python-bugs-list

Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences within a variable gene sequence. In addition to the non-degenerate A/G/ C/T, the gene sequence could have degenerate

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences within a variable gene sequence. In addition to the non-degenerate

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
On Oct 5, 3:38 pm, MRAB pyt...@mrabarnett.plus.com wrote: On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread Tim Chase
On 10/05/10 15:06, chaoticcran...@gmail.com wrote: On Oct 5, 3:38 pm, MRABpyt...@mrabarnett.plus.com wrote: On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
On 05/10/2010 21:06, chaoticcran...@gmail.com wrote: On Oct 5, 3:38 pm, MRABpyt...@mrabarnett.plus.com wrote: On 05/10/2010 20:03, chaoticcran...@gmail.com wrote: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread MRAB
[snip] Additional: I forgot to mention that you should understand the difference between the .match() and .search() mthods. .match() is anchored to the starting position, so you'll want to use .search() instead. -- http://mail.python.org/mailman/listinfo/python-list

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread Arnaud Delobelle
chaoticcran...@gmail.com chaoticcran...@gmail.com writes: So, I have a rather tricky string comparison problem: I want to search for a set pattern in a variable source. To give you the context, I am searching for set primer sequences within a variable gene sequence. In addition to the non

Re: Wildcard String Comparisons: Set Pattern to a Wildcard Source

2010-10-05 Thread chaoticcran...@gmail.com
Ah, very good, it's working perfectly now. Thank you so much for your help - regular expressions are very powerful! On Oct 5, 4:26 pm, MRAB pyt...@mrabarnett.plus.com wrote: [snip] Additional: I forgot to mention that you should understand the difference between the .match() and .search()

match pattern

2010-09-20 Thread rudikk00
Hi all, I remember perl has a match function =~/H/ -- which searches if there is H pattern in line. Is there a reasonable analog of it in python? thanks! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: match pattern

2010-09-20 Thread Ian Kelly
On Mon, Sep 20, 2010 at 12:58 PM, rudikk00 rudik...@yahoo.com wrote: Hi all, I remember perl has a match function =~/H/ -- which searches if there is H pattern in line. Is there a reasonable analog of it in python? Yes, have a look at the re module in the standard library. If all you're

Re: match pattern

2010-09-20 Thread Diez B. Roggisch
rudikk00 rudik...@yahoo.com writes: I remember perl has a match function =~/H/ -- which searches if there is H pattern in line. Is there a reasonable analog of it in python? It's called a regular expression, which can be matched or searched in a string. Take a look at the module re in python

[issue1686] string.Template.safe_substitute fail when overriding pattern attribute

2010-09-18 Thread Mark Lawrence
Mark Lawrence breamore...@yahoo.co.uk added the comment: Well what is the decision? FWIW I sway towards the +0 from msg112156 rather than the -0 from msg63791, but then what do I know? -- nosy: +BreamoreBoy ___ Python tracker rep...@bugs.python.org

[issue1686] string.Template.safe_substitute fail when overriding pattern attribute

2010-09-18 Thread Raymond Hettinger
Changes by Raymond Hettinger rhettin...@users.sourceforge.net: -- Removed message: http://bugs.python.org/msg63791 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1686 ___

[issue1686] string.Template.safe_substitute fail when overriding pattern attribute

2010-09-18 Thread Raymond Hettinger
Raymond Hettinger rhettin...@users.sourceforge.net added the comment: This looks fine. -- assignee: barry - resolution: - accepted ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue1686 ___

[issue1686] string.Template.safe_substitute fail when overriding pattern attribute

2010-09-18 Thread Florent Xicluna
Florent Xicluna florent.xicl...@gmail.com added the comment: Committed with r84888. -- assignee: - flox resolution: accepted - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org

Re: seach for pattern based on string

2010-08-26 Thread richie05 bal
the pattern bookId 20, noofBooks 6576, authorId 41, publishingCompanyId 7 but I don't know how search one based on another. Using a regular expression I would perform a match against each line. If the match fails, it will return None. If the match succeeds it returns a match object with which you

seach for pattern based on string

2010-08-24 Thread richie05 bal
to first search for AddNewBookD if found store bookId, noofBooks, authorId and publishingCompanyId I know how to search for only AddNewBookD or find the pattern bookId 20, noofBooks 6576, authorId 41, publishingCompanyId 7 but I don't know how search one based on another. -- http://mail.python.org

Re: seach for pattern based on string

2010-08-24 Thread Alex Willmer
, noofBooks 6577, authorId 42, publishingCompanyId 8} I want to first search for AddNewBookD if found    store bookId, noofBooks, authorId and publishingCompanyId I know how to search for only AddNewBookD or find the pattern bookId 20, noofBooks 6576, authorId 41, publishingCompanyId 7 but I

[issue1686] string.Template.safe_substitute fail when overriding pattern attribute

2010-07-31 Thread Florent Xicluna
Florent Xicluna florent.xicl...@gmail.com added the comment: The patch (braced_override.diff) still applies on 3.2. I am +0, because it is small and tested. What is the decision? -- nosy: +flox stage: - patch review versions: +Python 3.2 -Python 3.0

[issue6630] string.Template custom pattern not working

2010-07-29 Thread Georg Brandl
Georg Brandl ge...@python.org added the comment: Added in r83236. -- nosy: +georg.brandl resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6630 ___

Re: Visitor pattern and separating iteration

2010-07-23 Thread Karsten Wutzke
On 22 Jul., 22:25, Ian hobso...@gmaiil.com wrote: Hi Karsten, On 22/07/2010 12:03, Karsten Wutzke wrote: What is it I'm missing? I think you are making it more complicated than it really is. The visitor pattern is about bringing all the little bits that would otherwise be scattered all

Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
and code generation, but then the use of the visitor pattern becomes more and more questionable. What is it I'm missing? Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Visitor pattern and separating iteration

2010-07-22 Thread Karsten Wutzke
        # public final         modifierString =         i = 0         for modifier in method.getModifiers():             if i 0:                 modifierString +=             modifierString += modifier             i += 1 And please don't comment on the code itself, as I'm just

Re: Visitor pattern and separating iteration

2010-07-22 Thread Ian
Hi Karsten, On 22/07/2010 12:03, Karsten Wutzke wrote: What is it I'm missing? I think you are making it more complicated than it really is. The visitor pattern is about bringing all the little bits that would otherwise be scattered all over many node classes into one visitor class

Re: Visitor pattern and separating iteration

2010-07-22 Thread Mark Lawrence
use then? I'm rather tempted to ditch the idea of separating iteration and code generation, but then the use of the visitor pattern becomes more and more questionable. What is it I'm missing? Karsten I suggest you google for python patterns alex martelli. From what I've read, he's forgotten

Re: Code generator and visitor pattern

2010-07-18 Thread Mick Krippendorf
Mark Lawrence wrote: On 17/07/2010 20:38, Mick Krippendorf wrote: If Java were *really* a multiple dispatch language, it wouldn't be necessary to repeat the accept-code for every subclass. Instead a single accept method in the base class would suffice. In fact, with true multiple dispatch VP

Re: Code generator and visitor pattern

2010-07-17 Thread Mick Krippendorf
Karsten Wutzke wrote: The visitor pattern uses single-dispatch, that is, it determines which method to call be the type of object passed in. Say, in Python, I have an object o and want to call one of it's methods, say m. Then which of possibly many methods m to call is determined by the type

Re: Code generator and visitor pattern

2010-07-17 Thread Mick Krippendorf
of the motivating examples for the introduction of generators in Python was their use in flattening data structure, i.e. exactly the pattern used by os.walk. The Visitor Pattern isn't about traversing, so they could as well have had an os.walk() that took a visitor object. Instead, it's about

Re: Code generator and visitor pattern

2010-07-17 Thread Mark Lawrence
On 17/07/2010 20:38, Mick Krippendorf wrote: Karsten Wutzke wrote: The visitor pattern uses single-dispatch, that is, it determines which method to call be the type of object passed in. Say, in Python, I have an object o and want to call one of it's methods, say m. Then which of possibly many

Re: Code generator and visitor pattern

2010-07-16 Thread Michele Simionato
On Jul 15, 7:58 pm, Karsten Wutzke kwut...@web.de wrote: Hello, this is obviously a Python OO question: Since Python isn't stringly typed, single-dispatch isn't available per se. So is the double-dispatch Visitor pattern, which is usually used in OO systems to implement code generators. So

Re: Code generator and visitor pattern

2010-07-16 Thread Stefan Behnel
Carl Banks, 16.07.2010 07:50: On Jul 15, 8:33 pm, Stefan Behnel wrote: The code I referenced is from the Cython compiler, and we use it to do stuff with the AST. The visitor pattern is actually a pretty common way to bind code in a single place that does a certain thing to different parts

Re: Code generator and visitor pattern

2010-07-16 Thread Jean-Michel Pichavant
Karsten Wutzke wrote: Yes, typo, I meant strictly. Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten Stringly is the perfect combination of strictly and strongly. Nice one :) JM --

Re: Code generator and visitor pattern

2010-07-16 Thread Thomas Jollans
On 07/16/2010 11:00 AM, Jean-Michel Pichavant wrote: Karsten Wutzke wrote: Yes, typo, I meant strictly. Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten Stringly is the perfect combination of strictly and strongly. Nice

pattern matching with multiple lists

2010-07-16 Thread Chad Kellerman
Greetings, I have some code that I wrote and know there is a better way to write it.  I wonder if anyone could point me in the right direction on making this 'cleaner'. I have two lists:   liveHostList = [ app11, app12, web11, web12, host11 ]    

Re: pattern matching with multiple lists

2010-07-16 Thread MRAB
Chad Kellerman wrote: Greetings, I have some code that I wrote and know there is a better way to write it. I wonder if anyone could point me in the right direction on making this 'cleaner'. I have two lists: liveHostList = [ app11, app12, web11, web12, host11 ]

Re: pattern matching with multiple lists

2010-07-16 Thread Tim Chase
On 07/16/2010 02:20 PM, Chad Kellerman wrote: Greetings, I have some code that I wrote and know there is a better way to write it. I wonder if anyone could point me in the right direction on making this 'cleaner'. I have two lists: liveHostList = [ app11, app12, web11, web12,

Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
Hello, this is obviously a Python OO question: Since Python isn't stringly typed, single-dispatch isn't available per se. So is the double-dispatch Visitor pattern, which is usually used in OO systems to implement code generators. So, what is the de facto method in Python to handle source code

Re: Code generator and visitor pattern

2010-07-15 Thread Thomas Jollans
On 07/15/2010 07:58 PM, Karsten Wutzke wrote: Hello, this is obviously a Python OO question: Since Python isn't stringly typed, I expect this is an innocent typo, and you mean strictly. single-dispatch isn't available per se. So is the double-dispatch Visitor pattern, Wait, what

Re: Code generator and visitor pattern

2010-07-15 Thread Christian Heimes
Since Python isn't stringly typed, single-dispatch isn't available per se. So is the double-dispatch Visitor pattern, which is usually used in OO systems to implement code generators. So, what is the de facto method in Python to handle source code generation? Do you mean strongly typed

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
se. So is the double-dispatch Visitor pattern, Yes, typo, I meant strictly. Wait, what? First of all, python is strictly typed in that every object has exactly one type, which is different from other types. So you can't do 1+2, as you can in some other languages. Anyway

Re: Code generator and visitor pattern

2010-07-15 Thread Karsten Wutzke
Yes, typo, I meant strictly. Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. Karsten -- http://mail.python.org/mailman/listinfo/python-list

Re: Code generator and visitor pattern

2010-07-15 Thread Thomas Jollans
strictly. single-dispatch isn't available per se. So is the double-dispatch Visitor pattern, Yes, typo, I meant strictly. Wait, what? First of all, python is strictly typed in that every object has exactly one type, which is different from other types. So you can't do 1+2, as you can in some

Re: Code generator and visitor pattern

2010-07-15 Thread Stefan Behnel
Karsten Wutzke, 15.07.2010 20:45: Well, I'm most experienced in OO, so writing OO in Python seems like the way to start with Python. The visitor pattern uses single- dispatch, that is, it determines which method to call be the type of object passed in. Well, then do that. Put the types

Re: Code generator and visitor pattern

2010-07-15 Thread Stefan Behnel
Karsten Wutzke, 15.07.2010 21:00: Yes, typo, I meant strictly. Damn, I mean strongly. At least not for identifying which methods to call depending on the type/s. I think you meant statically typed. http://c2.com/cgi-bin/wiki?StronglyTyped http://www.c2.com/cgi/wiki?StaticTyping Stefan --

Re: Code generator and visitor pattern

2010-07-15 Thread MRAB
Stefan Behnel wrote: Karsten Wutzke, 15.07.2010 20:45: Well, I'm most experienced in OO, so writing OO in Python seems like the way to start with Python. The visitor pattern uses single- dispatch, that is, it determines which method to call be the type of object passed in. Well, then do

<    4   5   6   7   8   9   10   11   12   13   >