Re: [Tutor] re.Binding Events

2009-02-10 Thread ALAN GAULD


> I am mixing 2 examples given in "an-introduction-to- tkinter "
> by Fredrik Lundh.(and got this code)
> Today I got this error message
>

> Traceback (most recent call last):
>   File "", line 1, in 
>xx=app(root,event)
> NameError: global name 'event' is not defined

Which tells you that event is not recognised.
Where do you define event?

Also look at your call to app()
It is different to both calls in the examples:


> Example1=
...
> app = App(root)

> Example2=
> root = Tk()
> root.mainloop()
Where does your "event" come from? What purpose is it 
supposed to serve?

Alan G
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] re Binding Event

2009-02-10 Thread prasad rao
HelloI changed the code as follows.But still the callback function is not
working.
The he() is working well but clicking on the frame has no result.


class app:
  def __init__(self,root):
frame=Frame(root)
frame.bind("", callback)
frame.pack()
self.button=Button(root,text='quit',fg='red',command=frame.quit)
self.button.pack(side='left')
self.hi=Button(root,text='hi',fg='SystemWindowFrame',command=self.hi)
self.hi.pack(side='right')
self.callback
  def hi (self): print 'hello! there'
  def callback(self,event):
print "clicked at", event.x, event.y


>>> root=Tk()
>>> xx=app(root)
>>> root.mainloop()
hello! there
hello! there
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] re Binding Event

2009-02-10 Thread Alan Gauld


"prasad rao"  wrote

HelloI changed the code as follows.But still the callback function 
is not

working.
The he() is working well but clicking on the frame has no result.


class app:
 def __init__(self,root):
frame=Frame(root)
frame.bind("", callback)


Should this not be self.callback?


 def callback(self,event):
   print "clicked at", event.x, event.y


This looks like a method? Although the indentation is messed up
in the mail so I can't be sure.


root=Tk()
xx=app(root)
root.mainloop()

hello! there
hello! there



HTH

Alan G 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] help with loop that is to be fed out of a word list

2009-02-10 Thread Alan Gauld


"David"  wrote


def uses_all(word, required):
   for letter in required:
   if letter not in word:
   return False
   return True

Now, I want to feed this code a list of words. This is what I have 
so far:



def uses_all(required):


It is usually better to leave things that work alone.
You could have renamed the original finction then used it
in your new one. That would make the code much simpler.



   fin = open('words.txt')
   for line in fin:
   word = line.strip()

 if old_uses_all(word, required)
 print word

But as ever its better to return a value from a function rather
than print from inside so i'd make your new function:

def uses_all(required, wordfile="wordlist.txt"):
   words = []
   for line in open(wordfile):
   word = line.strip()
   if old_uses_all(word, required)
  words.append(word)
   return words

required = raw_input("what letters have to be used? ")
print required

for word in uses_all(required)
 print word

The code runs, but does not print the words. All I get it the output 
of

the 'print required' command:



I realise that my loop fails to execute beyond the first word in the
list ("aa"), but why?


Look at your code:


def uses_all(required):
   fin = open('words.txt')
   for line in fin:
   word = line.strip()
   for letter in required:
   if letter not in word:
   # print "False!"
   return False


return exits the function so the first letter you find that is not in
a word you will exit.


--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Lie Ryan
On Mon, 09 Feb 2009 14:42:47 -0800, Marc Tompkins wrote:

> Aha! My list of "magic words"!
> (Sorry for the top post - anybody know how to change quoting defaults in
> Android Gmail?)
> ---  www.fsrtechnologies.com
> 
> On Feb 9, 2009 2:16 PM, "Dinesh B Vadhia" 
> wrote:
> 
>  Kent /Emmanuel
> 
> I found a list of words before the first word that can be removed which
> I think is the only way to successfully parse the citations.  Here they
> are:
> 
> | E.g. | Accord | See |See + Also | Cf. | Compare | Contra | But + See |
> But + Cf. | See Generally | Citing | In |
> 

I think the only reliable way to parse all the citations correctly, in 
the absence of "magic word" is to have a list of names. It involves a bit 
of manual work, but should be good enough if there are a small number of 
cases that is cited a lot of times.

>>> names = '|'.join(['Carter', 'Jury Commision of Greene County', 'Lathe 
Turner', 'Fouche'])
>>> rep = '|'.join(['.*?'])
>>> dd = {'names': names, 'publ': rep}
>>> re.search(r'((%(names)s) v. (%(names)s)(, [0-9]+ (%(publ)s) [0-9]+)* 
\([0-9]+\))' % dd, text).group()

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE vs PythonWin

2009-02-10 Thread W W
On Mon, Feb 9, 2009 at 9:29 PM, Eric Dorsey  wrote:

> You can call a .py script from the command line, and it will run there. So,
> in Windows XP: Start > Run > type "CMD"
> Vista: Start > type "CMD" into the Start Search field.
> If you're in Linux, get to a Terminal.
> In Windows another window will open with something
> like...C:\FolderWithMyPyFile>
> Linux something like m...@ubuntu-desktop:~$
>
> Assuming "uberprogram.py" is in the current folder, you can then just type
> into the command prompt like C:\FolderWithMyPyFile>uberprogram  enter>
>
> You can see the results of the program right in the command prompt/terminal
> window.
>

Unless your program doesn't wait for any input before quitting.Then you just
have to add a line like this:

raw_input("Press  to quit")

and that will block until you hit return.
-Wayne
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Kent Johnson
On Mon, Feb 9, 2009 at 12:51 PM, Dinesh B Vadhia
 wrote:
> Kent /Emmanuel
>
> Below are the results using the PLY parser and Regex versions on the
> attached 'sierra' data which I think covers the common formats.  Here are
> some 'fully unparsed" citations that were missed by the programs:
>
> Smith v. Wisconsin Dept. of Agriculture, 23 F.3d 1134, 1141 (7th Cir.1994)
>
> Indemnified Capital Investments, S.A. v. R.J. O'Brien & Assoc., Inc., 12
> F.3d 1406, 1409 (7th Cir.1993).
>
> Hunt v. Washington Apple Advertising Commn., 432 U.S. 333, 343, 97 S.Ct.
> 2434, 2441, 53 L.Ed.2d 383 (1977)
>
> Idaho Conservation League v. Mumma, 956 F.2d 1508, 1517-18 (9th Cir.1992)

A few issues here:
S.A. - this is hard, to allow this while filtering out sentences
R.J. O'Brien, etc. - Loosening up the rules for the second name can allow these
1517-18 - allow page ranges

The name issues are getting to be too much for me. Attached is a PLY
version that just pulls out the citation without the name; at one
point you indicated that would work for you.

Kent
# Parser for legal citations, PLY version
# This version doesn't parse the names

from ply import lex, yacc

debug = 0

text = """Indemnified Capital Investments, S.A. v. R.J. O'Brien & Assoc., Inc., 12 F.3d 1406, 1409 (7th Cir.1993).
Hunt v. Washington Apple Advertising Commn., 432 U.S. 333, 343, 97 S.Ct. 2434, 2441, 53 L.Ed.2d 383 (1977)
Smith v. Wisconsin Dept. of Agriculture, 23 F.3d 1134, 1141 (7th Cir.1994)
 
  
Idaho Conservation League v. Mumma, 956 F.2d 1508, 1517-18 (9th Cir.1992)
NFMA, NEPA, or MUSYA. Sierra Club v. Marita, 843 F.Supp. 1526 (E.D.Wis.1994) ("Nicolet ").
Page 500 Carter v. Jury Commission of Greene County, 396 U.S. 320, 90 S.Ct. 518, 24 L.Ed.2d 549 (1970); 
Lathe Turner v. Fouche, 396 U.S. 346, 90 S.Ct. 532, 24 L.Ed.2d 567 (1970); 
White v. Crook, 251 F.Supp. 401 (DCMD Ala.1966). 

Moreover, the Court has also recognized that the exclusion of a discernible class from jury service 
injures not only those defendants who belong to the excluded class, 
but other defendants as well, in that it destroys the possibility 
that the jury will reflect a representative cross section of the community. 

In John Doggone Williams v. Florida, 399 U.S. 78, 90 S.Ct. 1893, 234, 26 L.Ed.2d 446 (1970), 

we sought to delineate some of the essential features of the jury that is guaranteed, 
in certain circumstances, by the Sixth Amendment. We concluded that it comprehends, 
inter alia, 'a fair possibility for obtaining a representative cross-section of the community.' 
399 U.S., at 100, 90 S.Ct., at 1906.9 Thus if the Sixth Amendment were applicable here, 
and petitioner were challenging a post-Duncan petit jury, 
he would clearly have standing to challenge the systematic exclusion of any identifiable group from jury service."""

# Lexical tokens

tokens = (
   'NUMBER',
   'MIXED',
   'YEAR',
)

literals = ",()-"

# Regular expression rules for simple tokens
t_NUMBER = r'\d+'
t_MIXED = r'[A-Za-z][A-Za-z.0-9\']+'  # References and names after the first work
t_YEAR = r'\([^)]+\)'   # Note: "year" can contain multiple words and non-numeric

# A string containing ignored characters (spaces and tabs)
t_ignore  = ' \t\r\n'

# Error handling rule
def t_error(t):
t.lexer.skip(1)

# Build the lexer
lexer = lex.lex()

def test_lexer(data):
lexer.input(data)

# Tokenize
while True:
tok = lexer.token()
if not tok: break  # No more input
print tok

# Parser productions

def p_Page(p):
'''page : NUMBER
  | NUMBER '-' NUMBER'''
if len(p) == 2:
p[0] = p[1]
else:
p[0] = p[1] + p[2] + p[3]

def p_Reference(p):
'''reference : NUMBER MIXED page'''
p[0] = '%s %s %s' % (p[1], p[2], p[3])

def p_Reference_List(p):
'''reference_list : reference
  | reference_list ',' page
  | reference_list ',' reference
  | reference_list ',' page ',' reference'''

if len(p) == 2:
p[0] = [p[1]]   # single reference
elif len(p) == 4:
if p.slice[3].type == 'reference':
p[0] = p[1] + [p[3]]   # append new reference
else:
p[1][-1] += ', %s' % p[3]   # append page number
p[0] = p[1]
else:
# page number and reference
p[1][-1] += ', %s' % p[3]   # append page number
p[0] = p[1] + [p[5]]   # append new reference


def p_Citation(p):
'''citation : reference_list YEAR error'''
for reference in p[1]:
print '%s %s' % (reference, p[2])
print

def p_Citations(p):
'''citations : citation
 | citations citation'''
pass


def p_error(p):
pass

start = 'citations'


# Build the parser
parser = yacc.yacc()


if __name__ == '__main__':
parser.parse(text, debug=debug)

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple PassGen

2009-02-10 Thread python
Kent,

> Except they are not equivalent when you want to print more than one thing. 
> ...
> Python 2.6:
> In [1]: print(3, 4)
> (3, 4)

I'm running Python 2.6.1 (32-bit) on Windows XP.

I don't get the tuple-like output that you get.

Here's what I get:

>>> print( 3, 4 )
3 4

Malcolm
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tkinter program start with focus?`

2009-02-10 Thread Wayne Watson
Title: Signature.html




I have no idea, but I'm going to take a guess based on what you said
that helped me understand code someone else wrote. See Chapter 9 of
Lundh's An Intro to TkInter. TkSimpleDialog. 

WW

W W wrote:
Hi,
  
  
  I'm running into a problem that's bugging me because I know a
program used it, I just can't find which one it was...
  
  
  I want my Tkinter program to start with the focus, but I can't
remember the command.
  
  
  TIA,
  Wayne
  
-- 
To be considered stupid and to be told so is more painful than being
called gluttonous, mendacious, violent, lascivious, lazy, cowardly:
every weakness, every vice, has found its defenders, its rhetoric, its
ennoblement and exaltation, but stupidity hasn't. - Primo Levi
  
  
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
  


-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)



The Richard Feynman Problem-Solving
Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer.



Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE vs PythonWin

2009-02-10 Thread Wayne Watson




Thanks, but I think I'll keep my IDLE training wheels on for awhile yet.

ALAN GAULD wrote:

  
  I
have 3 windows open.
  
An editor
A Python shell
An OS console
  
The editor is used to edit the code
The python shell for interactive experiments and tests
The console for running the program
  
Thus I save the file in the editor, alt-tab to 
the console and type
  
python myscript.py
  
to run it. (In practice, apart from the first time, 
I hit up-arrow; return, to run it.)
  
In fact I could run the script from within vim or 
Scite since they both have the ability to run 
external commands from within the editor, but I 
prefer to have a eparate window where I can refer 
to the output of previous runs by scrolling back.
   
Alan Gauld
Author of the Learn To Program website
  http://www.alan-g.me.uk/
  
  
  
  
  
  From:
Wayne Watson 
  To: ALAN GAULD
  
  Sent: Tuesday, 10
February, 2009 1:09:13 AM
  Subject: Re: [Tutor]
IDLE vs PythonWin
  
You must be up 24/7!
When I open a py file with pythonwin, it brings up the dialog and in
its window, there are two windows. One is called interactive window
(IW), and the other (script window--SW) contains the program py code.
To execute it, I press the little running icon or F5 and two printed
lines appear, as they should, in the IW. If I remove the SW, how do I
run it in another "editor", vi, vim, emacs, notebook, ... whatever, and
see the output in the IW? 
  
ALAN GAULD wrote:
  


>
Yes, but how do you debug the code interactively when you have 
> the
editor outside pythonwin? Do you copy it into the pythonwin editor?

Do you mean using the Python debugger?
If I need to do that I will either use the command line debugger (pdb) 
inside the shell window or close the vim session and start pythonwin 
(or Eclipse which has a really good debugger!) But in 10 years of using

Python I've only resorted to the debugger maybe a dozen times in total.
Usually a few print statements and a session with the >>>
prompt is 
adequate to find any bugs. The best debugging tools are your eyes!

Remember too that you can always import the module into the shell 
window if you need to test specific functions in isolation.

Alan G.


ALAN GAULD wrote:

  The
point wasn't about vim per se - that just 
happens to be my favourite editor - but really 
about the way of working with 3 separate windows.
  
Really it was just to show that you don't necessarily 
need to use an all-in-one IDE like Pythonwin or IDLE, 
  





  
  
  -- 
  Signature.html
 Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)

  
  
  The Richard Feynman
Problem-Solving
Algorithm:
    (1) write down the problem;
    (2) think very hard;
    (3) write down the answer.
  
  
  
Web Page: 
  
  
  
  


-- 

Signature.html
   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)



The Richard Feynman Problem-Solving
Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer.



Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple PassGen

2009-02-10 Thread Lie Ryan
On Tue, 10 Feb 2009 09:43:18 -0500, python wrote:

> Kent,
> 
>> Except they are not equivalent when you want to print more than one
>> thing. ...
>> Python 2.6:
>> In [1]: print(3, 4)
>> (3, 4)
> 
> I'm running Python 2.6.1 (32-bit) on Windows XP.
> 
> I don't get the tuple-like output that you get.
> 
> Here's what I get:
> 
 print( 3, 4 )
> 3 4

Are you sure it isn't python 3.x you're playing with? The reason why 
simple print function "works" in python 2.x is because of a syntactical 
coincidence, it is still a 100% statement. 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple PassGen

2009-02-10 Thread python
Lie,

>> Here's what I get:
>> 
>> >>> print( 3, 4 )
>> 3 4

> Are you sure it isn't python 3.x you're playing with? The reason why simple 
> print function "works" in python 2.x is because of a syntactical 
coincidence, it is still a 100% statement.

Yes, I'm sure :) I restarted IDLE and pasted my session output below:



Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.


Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface.  This connection is not visible on any external
interface and no data is sent to or received from the Internet.


IDLE 2.6.1  
>>> from __future__ import print_function
>>> print( 3, 4 )
3 4
>>> 



Malcolm



- Original message -
From: "Lie Ryan" 
To: tutor@python.org
Date: Tue, 10 Feb 2009 15:15:01 + (UTC)
Subject: Re: [Tutor] Simple PassGen

On Tue, 10 Feb 2009 09:43:18 -0500, python wrote:

> Kent,
> 
>> Except they are not equivalent when you want to print more than one
>> thing. ...
>> Python 2.6:
>> In [1]: print(3, 4)
>> (3, 4)
> 
> I'm running Python 2.6.1 (32-bit) on Windows XP.
> 
> I don't get the tuple-like output that you get.
> 
> Here's what I get:
> 
 print( 3, 4 )
> 3 4

Are you sure it isn't python 3.x you're playing with? The reason why 
simple print function "works" in python 2.x is because of a syntactical 
coincidence, it is still a 100% statement. 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple PassGen

2009-02-10 Thread spir
Le Tue, 10 Feb 2009 10:26:54 -0500,
pyt...@bdurham.com a écrit :

> IDLE 2.6.1  
> >>> from __future__ import print_function
> >>> print( 3, 4 )  
> 3 4

lol!

--
la vida e estranya
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Reply All Dilemma of This List

2009-02-10 Thread Wayne Watson
Title: Signature.html




I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and
mail lists. Probably 100 or more. I think it's fair to say that none of
them but this one has an implicit "Reply All". For newsgroups and mail
lists, I just press my Mozilla Seamonkey mailer Reply button and the
resulting message is ready to be seen by everyone, a single address.
Here a Reply goes only to the poster, none to Tutor. Elsewhere, for
e-mail-like posts, if I really want to make a special effort to single
out the poster too, "Reply All" works to additionally get it directly
to them (actually they'd get two messages directly) and the entire
list.  For YGs and forums, the  "Reply All" is implicit in a response. 

Since this group, in my world, is unique in these matters, I'll just
offer the following header for a mail list I belong to, the ASTC, for
someone's consideration. I suppose that someone might be whoever
created this mail list. It' definitely different than used here, and no
one uses "Reply All" to my knowledge. 

Maybe they can figure out if it has applicability here. 
-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)



The Richard Feynman Problem-Solving
Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer.



Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Inserting special characters into urlencoded string

2009-02-10 Thread pa yo
Novice programmer here.

I am using urllib.urlencode to post content to a web page:

...
>>Title = "First Steps"
>>Text = "Hello World."
>>Username = "Payo2000"
>>Content = Text + "From: " + Username
>>SubmitText = urllib.urlencode(dict(Action = 'submit', Headline = Title, 
>>Textbox = Content))
>>Submit = opener.open('http://www.website.com/index.php?', SubmitText)

This works fine to produce in this:

"Hello World From Payo2000"

...on the page.

However I can't work out how to add a linefeed (urlencode: %0A) in
front of Username so that I get:

"Hello World.
From: Payo2000"

Any hints, tips or suggestions welcome!

Payo
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Reply All Dilemma of This List

2009-02-10 Thread Brian Mathis
You've stepped on a religious-war landmine.  You can read all about
why this is bad here:
http://www.unicom.com/pw/reply-to-harmful.html ("Reply-To" Munging
Considered Harmful)
and why it's good here:
http://www.metasystema.net/essays/reply-to.mhtml (Reply-To Munging
Considered Useful)

This war has been raging since the dawn of mailing lists, and you're
not likely to get a resolution now either.


To me, the context of a mailing list warrants the use of Reply-All to
the list, since a mailing list is typically meant to be a group
discussion.  In this configuration, it takes extra effort to reply
privately, which is exactly the sort of thing you'd want to promote in
a group discussion.


On Tue, Feb 10, 2009 at 10:59 AM, Wayne Watson
 wrote:
> I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and mail
> lists. Probably 100 or more. I think it's fair to say that none of them but
> this one has an implicit "Reply All". For newsgroups and mail lists, I just
> press my Mozilla Seamonkey mailer Reply button and the resulting message is
> ready to be seen by everyone, a single address. Here a Reply goes only to
> the poster, none to Tutor. Elsewhere, for e-mail-like posts, if I really
> want to make a special effort to single out the poster too, "Reply All"
> works to additionally get it directly to them (actually they'd get two
> messages directly) and the entire list.  For YGs and forums, the  "Reply
> All" is implicit in a response.
>
> Since this group, in my world, is unique in these matters, I'll just offer
> the following header for a mail list I belong to, the ASTC, for someone's
> consideration. I suppose that someone might be whoever created this mail
> list. It' definitely different than used here, and no one uses "Reply All"
> to my knowledge.
>
> Maybe they can figure out if it has applicability here.
> --
>
>Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
>
>  (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
>
>
> The Richard Feynman Problem-Solving Algorithm:
>   (1) write down the problem;
>   (2) think very hard;
>   (3) write down the answer.
>
> Web Page: 
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Reply All Dilemma of This List

2009-02-10 Thread Martin Walsh
Wayne Watson wrote:
> I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and
> mail lists. Probably 100 or more. I think it's fair to say that none of
> them but this one has an implicit "Reply All". For newsgroups and mail
> lists, I just press my Mozilla Seamonkey mailer Reply button and the
> resulting message is ready to be seen by everyone, a single address.
> Here a Reply goes only to the poster, none to Tutor. Elsewhere, for
> e-mail-like posts, if I really want to make a special effort to single
> out the poster too, "Reply All" works to additionally get it directly to
> them (actually they'd get two messages directly) and the entire list. 
> For YGs and forums, the  "Reply All" is implicit in a response.
> 
> Since this group, in my world, is unique in these matters, I'll just
> offer the following header for a mail list I belong to, the ASTC, for
> someone's consideration. I suppose that someone might be whoever created
> this mail list. It' definitely different than used here, and no one uses
> "Reply All" to my knowledge.
> 
> Maybe they can figure out if it has applicability here.

This is a contentious topic which comes up at least once a year on this
list. A search of the archives will turn up some interesting debate,
most likely. FWIW, I like the behavior of this list as opposed to others.

You may find these additional references illuminating ... you may not.
http://effbot.org/pyfaq/tutor-why-do-my-replies-go-to-the-person-who-sent-the-message-and-not-to-the-list.htm
http://woozle.org/~neale/papers/reply-to-still-harmful.html

HTH,
Marty


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Dinesh B Vadhia
Kent

The citation without the name is perfect (and this appears to be how most 
citation parsers work).  There are two issues in the test run:

1.  The parallel citation 422 U.S. 490, 499 n. 10, 95 S.Ct. 2197, 2205 n. 10, 
45 L.Ed.2d 343 (1975) is resolved as:

422 U.S. 490 (1975)
499 n. 10 (1975)
95 S.Ct. 2197 (1975)
2205 n. 10 (1975)
45 L.Ed.2d 343 (1975)

instead of as:

422 U.S. 490, 499 n. 10 (1975)
95 S.Ct. 2197, 2205 n. 10 (1975)
45 L.Ed.2d 343 (1975)

ie. parsing the second page references should pick up all alphanumeric chars 
between the commas.

2. It doesn't parse the last citation ie. 463 U.S. 29, 43, 103 S.Ct. 2856, 
2867, 77 L.Ed.2d 443 (1983).  I tested it on another sample text and it missed 
the last citation too.

Thanks!

Dinesh


 
From: Kent Johnson 
Sent: Tuesday, February 10, 2009 4:01 AM
To: Dinesh B Vadhia 
Cc: tutor@python.org 
Subject: Re: [Tutor] Picking up citations


On Mon, Feb 9, 2009 at 12:51 PM, Dinesh B Vadhia
 wrote:
> Kent /Emmanuel
>
> Below are the results using the PLY parser and Regex versions on the
> attached 'sierra' data which I think covers the common formats.  Here are
> some 'fully unparsed" citations that were missed by the programs:
>
> Smith v. Wisconsin Dept. of Agriculture, 23 F.3d 1134, 1141 (7th Cir.1994)
>
> Indemnified Capital Investments, S.A. v. R.J. O'Brien & Assoc., Inc., 12
> F.3d 1406, 1409 (7th Cir.1993).
>
> Hunt v. Washington Apple Advertising Commn., 432 U.S. 333, 343, 97 S.Ct.
> 2434, 2441, 53 L.Ed.2d 383 (1977)
>
> Idaho Conservation League v. Mumma, 956 F.2d 1508, 1517-18 (9th Cir.1992)

A few issues here:
S.A. - this is hard, to allow this while filtering out sentences
R.J. O'Brien, etc. - Loosening up the rules for the second name can allow these
1517-18 - allow page ranges

The name issues are getting to be too much for me. Attached is a PLY
version that just pulls out the citation without the name; at one
point you indicated that would work for you.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Simple PassGen

2009-02-10 Thread python
DOH! I just realized why we're getting different results. Sorry for the
confusion - I wasn't trying to be a smart-ass!

We've been trying to future proof our new code for Python 3.x so we
automatically have 3.0 print() functionality enabled in our Python 2.6
dev environments.

Malcolm

- Original message -
From: "spir" 
To: tutor@python.org
Date: Tue, 10 Feb 2009 16:35:26 +0100
Subject: Re: [Tutor] Simple PassGen

Le Tue, 10 Feb 2009 10:26:54 -0500,
pyt...@bdurham.com a écrit :

> IDLE 2.6.1  
> >>> from __future__ import print_function
> >>> print( 3, 4 )  
> 3 4

lol!

--
la vida e estranya
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Inserting special characters into urlencoded string

2009-02-10 Thread spir
Le Tue, 10 Feb 2009 18:08:26 +0100,
pa yo  a écrit :

> Novice programmer here.
> 
> I am using urllib.urlencode to post content to a web page:
> 
> ...
> >>Title = "First Steps"
> >>Text = "Hello World."
> >>Username = "Payo2000"
> >>Content = Text + "From: " + Username
> >>SubmitText = urllib.urlencode(dict(Action = 'submit', Headline = Title, 
> >>Textbox = Content))
> >>Submit = opener.open('http://www.website.com/index.php?', SubmitText)
> 
> This works fine to produce in this:
> 
> "Hello World From Payo2000"
> 
> ...on the page.
> 
> However I can't work out how to add a linefeed (urlencode: %0A) in
> front of Username so that I get:
> 
> "Hello World.
> From: Payo2000"
> 
> Any hints, tips or suggestions welcome!

In python (and many other languages) some special characters that are not easy 
to represent have a code:
LF : \n
CR : \r
TAB : \t
So just add \n to to first line to add an eol: Text = "Hello World.\n" [Beware 
that inside python \n actually both means char #10 and 'newline', 
transparently, whatever the os uses as 'newline' code for text files. Very 
handy.]
Alternatively, as you seem to be used to web codes, you can have hexa 
representation \x0a or even octal \012

Denis
-
la vida e estranya
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Reply All Dilemma of This List

2009-02-10 Thread spir
Le Tue, 10 Feb 2009 12:20:51 -0500,
Brian Mathis  a écrit :

> This war has been raging since the dawn of mailing lists, and you're
> not likely to get a resolution now either.

Newer mail user agents have a "to list" reply button. End of war?

--
la vida e estranya
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Inserting special characters into urlencoded string

2009-02-10 Thread pa yo
"Denis,\n\nThat works perfectly!\n\nMerci Beaucoup!\n\nPayo"

:-)

On Tue, Feb 10, 2009 at 6:48 PM, spir  wrote:
> Le Tue, 10 Feb 2009 18:08:26 +0100,
> pa yo  a écrit :
>
>> Novice programmer here.
>>
>> I am using urllib.urlencode to post content to a web page:
>>
>> ...
>> >>Title = "First Steps"
>> >>Text = "Hello World."
>> >>Username = "Payo2000"
>> >>Content = Text + "From: " + Username
>> >>SubmitText = urllib.urlencode(dict(Action = 'submit', Headline = Title, 
>> >>Textbox = Content))
>> >>Submit = opener.open('http://www.website.com/index.php?', SubmitText)
>>
>> This works fine to produce in this:
>>
>> "Hello World From Payo2000"
>>
>> ...on the page.
>>
>> However I can't work out how to add a linefeed (urlencode: %0A) in
>> front of Username so that I get:
>>
>> "Hello World.
>> From: Payo2000"
>>
>> Any hints, tips or suggestions welcome!
>
> In python (and many other languages) some special characters that are not 
> easy to represent have a code:
> LF : \n
> CR : \r
> TAB : \t
> So just add \n to to first line to add an eol: Text = "Hello World.\n" 
> [Beware that inside python \n actually both means char #10 and 'newline', 
> transparently, whatever the os uses as 'newline' code for text files. Very 
> handy.]
> Alternatively, as you seem to be used to web codes, you can have hexa 
> representation \x0a or even octal \012
>
> Denis
> -
> la vida e estranya
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Reply All Dilemma of This List

2009-02-10 Thread Robert Berman




Mozilla Thunderbird  version 2.0.0.19 (20090105)
running under Ubuntu Linux 8.10 does not have  "Reply to Group". Even
if it did, out of habit I would be hitting the "Reply All" button. Old
preferences die hard.

Robert

spir wrote:

  Le Tue, 10 Feb 2009 12:20:51 -0500,
Brian Mathis  a écrit :

  
  
This war has been raging since the dawn of mailing lists, and you're
not likely to get a resolution now either.

  
  
Newer mail user agents have a "to list" reply button. End of war?

--
la vida e estranya
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
  



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Splitting strings and undefined variables

2009-02-10 Thread Andreas Kostyrka
Am Mon, 9 Feb 2009 12:05:33 -0800
schrieb Moos Heintzen :

> Hello all,
> 
> I was looking at this:
> http://www.debian.org/doc/manuals/reference/ch-program.en.html#s-python
> 
> I have a question about the line of code that uses split()
> 
> With the python version, the line below only works if there are three
> fields in line.
> 
> (first, last, passwd) = line.split()
> 
> Also, since the variables are used like this:
> 
> lineout = "%s:%s:%d:%d:%s %s,,/home/%s:/bin/bash\n" %  \
>  (user, passwd, uid, gid, first, last, user)
> 
> I can't use ":".join(line.split())
> But maybe a dictionary could be used for string substitution.
> 
> In the perl version (above the python version in the link), the script
> works with the input line having one to three fields. Like "fname
> lname pw" or "fname lname"
> 
> ($n1, $n2, $n3) = split / /;
> 
> Is there a better way to extract the fields from line in a more
> flexible way, so that the number of fields could vary?
> I guess we could use conditionals to check each field, but is there a
> more elegant (or pythonic!) way to do it?

Well, the problem you are getting is probably a ValueError, meaning that
the number of items does not match the expected number:

>>> a, b = 1, 2, 3
Traceback (most recent call last):
  File "", line 1, in 
ValueError: too many values to unpack
>>> a, b, c, d = 1, 2, 3
Traceback (most recent call last):
  File "", line 1, in 
ValueError: need more than 3 values to unpack

Assuming that you want to have empty strings as the default you can use:

a, b, c = (line.split() + ["", ""])[:3]

Ok, step by step:

line.split() produces a list with at least one string, assuming that
line is a string.

line.split() + ["", ""] creates a new list with two empty strings added
to the end.

[:3] gives you the first three strings of that list.

Generally speaking, the above should be only used when you really
really know that you want to threat your data such a way (ignore all
later fields, add empty strings), it has a real potential for later
debugging pains, when the data turns out to be different than what you
expected.

Another way would be:

a, b, c = "defaultA", "defaultB", "defaultC"
try:
flds = line.split()
a = flds[0]
b = flds[1]
c = flds[2]
except IndexError:
pass

That still ignores any errors coming your way, usually it's better to
check on len(flds).

Generally, defensive programming (as in processing ANY data given,
e.g. HTML parsing in browsers) is sometimes necessary, but often not
such a good idea (one usually prefers an error message than faulty
output data. Nothing more embarrasing then contacting your customers to
tell them that the billing program was faulty and you billed them to
much the last two years *g*).

Andreas



> 
> Moos
> 
> P.S. I'm not a Perl user, I was just reading the examples. I've been
> using C and awk for few years, and Python for few months. Also, I know
> blank passwords aren't very practical, but I'm just asking this to
> explore possibilities :)
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Kent Johnson
On Tue, Feb 10, 2009 at 12:42 PM, Dinesh B Vadhia
 wrote:
> Kent
>
> The citation without the name is perfect (and this appears to be how most
> citation parsers work).  There are two issues in the test run:
>
> 1.  The parallel citation 422 U.S. 490, 499 n. 10, 95 S.Ct. 2197, 2205 n.
> 10, 45 L.Ed.2d 343 (1975) is resolved as:
>
> 422 U.S. 490 (1975)
> 499 n. 10 (1975)
> 95 S.Ct. 2197 (1975)
> 2205 n. 10 (1975)
> 45 L.Ed.2d 343 (1975)
>
> instead of as:
>
> 422 U.S. 490, 499 n. 10 (1975)
> 95 S.Ct. 2197, 2205 n. 10 (1975)
> 45 L.Ed.2d 343 (1975)
>
> ie. parsing the second page references should pick up all alphanumeric chars
> between the commas.

So 499 n. 10 is a page reference? I can't pick up all alphanumeric
chars between commas, that would include a second reference.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] can't import Danny.OOo.OOoLib.py

2009-02-10 Thread johnf
Hi,
How silly of me to think I understood the import command.  I'm trying to learn 
how to automate printing documents from OpenOffice using python.  I found 
several ways and I was able to get some of them to work.  But I found the 
Danny.OOo.OOoLib.py tools (kind of old 2005 but still on the wiki) and was 
hoping I could try them.  I placed the Danny.OOo.OOoLib.py file into my local 
folder and attempted to import.  It immediately fails with the following  
message:
ImportError: No module named Danny.OOo.OOoLib

So could someone enlighten me as to why it reports this error?  The file is in 
the local directory/folder.  I cd to the directory.  What else is required?

-- 
John Fabiani
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] can't import Danny.OOo.OOoLib.py

2009-02-10 Thread Kent Johnson
On Tue, Feb 10, 2009 at 1:42 PM, johnf  wrote:
> Hi,
> How silly of me to think I understood the import command.  I'm trying to learn
> how to automate printing documents from OpenOffice using python.  I found
> several ways and I was able to get some of them to work.  But I found the
> Danny.OOo.OOoLib.py tools (kind of old 2005 but still on the wiki) and was
> hoping I could try them.  I placed the Danny.OOo.OOoLib.py file into my local
> folder and attempted to import.  It immediately fails with the following
> message:
> ImportError: No module named Danny.OOo.OOoLib

It's looking for Danny/OOo/OOoLib.py. Try renaming the file to have no
. in the file name.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Paul McGuire
Dinesh and Kent -

I've been lurking along as you run this problem to ground.  The syntax you
are working on looks very slippery, and reminds me of some of the issues I
had writing a generic street address parser with pyparsing
(http://pyparsing.wikispaces.com/file/view/streetAddressParser.py).  Mailing
list companies spend beaucoup $$$ trying to parse addresses in order to
filter duplicates, to group by zip code, street, neighborhood, etc., and
this citation format looks similarly scary.  

Congratulations on getting to a 95% solution using PLY.

-- Paul

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Dinesh B Vadhia
I'm guessing that  '499 n. 10' is a page reference ie. page 499, point number 
10.  Legal citations are all a mystery - they even have their own citation 
bluebook (http://www.legalbluebook.com/) !

Dinesh




From: Kent Johnson 
Sent: Tuesday, February 10, 2009 10:57 AM
To: Dinesh B Vadhia 
Cc: tutor@python.org 
Subject: Re: [Tutor] Picking up citations


On Tue, Feb 10, 2009 at 12:42 PM, Dinesh B Vadhia
 wrote:
> Kent
>
> The citation without the name is perfect (and this appears to be how most
> citation parsers work).  There are two issues in the test run:
>
> 1.  The parallel citation 422 U.S. 490, 499 n. 10, 95 S.Ct. 2197, 2205 n.
> 10, 45 L.Ed.2d 343 (1975) is resolved as:
>
> 422 U.S. 490 (1975)
> 499 n. 10 (1975)
> 95 S.Ct. 2197 (1975)
> 2205 n. 10 (1975)
> 45 L.Ed.2d 343 (1975)
>
> instead of as:
>
> 422 U.S. 490, 499 n. 10 (1975)
> 95 S.Ct. 2197, 2205 n. 10 (1975)
> 45 L.Ed.2d 343 (1975)
>
> ie. parsing the second page references should pick up all alphanumeric chars
> between the commas.

So 499 n. 10 is a page reference? I can't pick up all alphanumeric
chars between commas, that would include a second reference.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Kent Johnson
On Tue, Feb 10, 2009 at 12:42 PM, Dinesh B Vadhia
 wrote:
> Kent
>
> The citation without the name is perfect (and this appears to be how most
> citation parsers work).  There are two issues in the test run:
>
> 1.  The parallel citation 422 U.S. 490, 499 n. 10, 95 S.Ct. 2197, 2205 n.
> 10, 45 L.Ed.2d 343 (1975) is resolved as:
>
> 422 U.S. 490 (1975)
> 499 n. 10 (1975)
> 95 S.Ct. 2197 (1975)
> 2205 n. 10 (1975)
> 45 L.Ed.2d 343 (1975)

> 2. It doesn't parse the last citation ie. 463 U.S. 29, 43, 103 S.Ct. 2856,
> 2867, 77 L.Ed.2d 443 (1983).  I tested it on another sample text and it
> missed the last citation too.

Another attempt attached, it recognizes the n. separator and gets the last item.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] IDLE

2009-02-10 Thread WM.
A while back I made a big fuss about how IDLE indenting works. Kent was 
finally able to use language simple enough for me to understand. So I 
kept working IDLE. Today I got an error message. Somebody fixed it! It 
now indents just like all the other Python windows. Great going, Snake. 
And thank you guys.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] IDLE

2009-02-10 Thread Alan Gauld


"WM."  wrote

A while back I made a big fuss about how IDLE indenting works. Kent 
was finally able to use language simple enough for me to understand. 
So I kept working IDLE. Today I got an error message. Somebody fixed 
it! It now indents just like all the other Python windows. Great 
going, Snake.


Can you share how you got it fixed? I'd love to see an IDLE that
indented sensibly!

Alan G 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Reply All Dilemma of This List

2009-02-10 Thread Wayne Watson
Title: Signature.html




Oh, I realize that chances are slim to do anything about it. So how did
this list get started? How old is it?
Fortunately, there are other choices, which I can make, if re-posting
to Tutor becomes too often or long delayed by my cranky mouse use. ;-)
Two lists anyone? :-)

Martin Walsh wrote:

  Wayne Watson wrote:
  
  
I belong to many, many forums, Yahoo Groups, (Usenet) newsgroups, and
mail lists. Probably 100 or more. I think it's fair to say that none of
them but this one has an implicit "Reply All". For newsgroups and mail
lists, I just press my Mozilla Seamonkey mailer Reply button and the
resulting message is ready to be seen by everyone, a single address.
Here a Reply goes only to the poster, none to Tutor. Elsewhere, for
e-mail-like posts, if I really want to make a special effort to single
out the poster too, "Reply All" works to additionally get it directly to
them (actually they'd get two messages directly) and the entire list. 
For YGs and forums, the  "Reply All" is implicit in a response.

Since this group, in my world, is unique in these matters, I'll just
offer the following header for a mail list I belong to, the ASTC, for
someone's consideration. I suppose that someone might be whoever created
this mail list. It' definitely different than used here, and no one uses
"Reply All" to my knowledge.

Maybe they can figure out if it has applicability here.

  
  
This is a contentious topic which comes up at least once a year on this
list. A search of the archives will turn up some interesting debate,
most likely. FWIW, I like the behavior of this list as opposed to others.

You may find these additional references illuminating ... you may not.
http://effbot.org/pyfaq/tutor-why-do-my-replies-go-to-the-person-who-sent-the-message-and-not-to-the-list.htm
http://woozle.org/~neale/papers/reply-to-still-harmful.html

HTH,
Marty


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

  


-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)



The Richard Feynman Problem-Solving
Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer.



Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] IDLE

2009-02-10 Thread WM.
Allen G.asked me how I made IDLE work. I did nothing on purpose. One can 
open Python into the IDLE window or into the program window. I recently 
changed from the program window to the IDLE window. IDLE now works 
exactly right.  As a bonus my DOS-oidle window which used to produce 
error messages now works like a Trojan, also.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] IDLE/phythonWin -- Who's On First? (Abbott and Costello)

2009-02-10 Thread Wayne Watson
Title: Signature.html




My program in IDLE bombed with:
==
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 1403, in __call__
    return self.func(*args)
  File
"C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py",
line 552, in OperationalSettings
    dialog = OperationalSettingsDialog( self.master, set_loc_dict )
  File
"C:\Sandia_Meteors\New_Sentinel_Development\Sentuser_Utilities_Related\sentuser\sentuserNC25-Dev4.py",
line 81, in __init__
    tkSimpleDialog.Dialog.__init__(self, parent)
  File "C:\Python25\lib\lib-tk\tkSimpleDialog.py", line 69, in __init__
    self.wait_visibility() # window needs to be visible for the grab
  File "C:\Python25\lib\lib-tk\Tkinter.py", line 415, in wait_visibility
    self.tk.call('tkwait', 'visibility', window._w)
TclError: window ".34672232" was deleted before its visibility changed
===
But runs fine in pythonWin performing the same entry operation. Open a
menu,  select an item to open a dialog, select the same button in the
dialog, press OK to leave the dialog. Boom, as above. 

(This does not mean pythonWin doesn't have problems of its own. ) If I
just execute the code, the console shows no problems. IDLE is unhappy.

-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)



The Richard Feynman Problem-Solving
Algorithm:
  (1) write down the problem;
  (2) think very hard;
  (3) write down the answer.



Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Picking up citations

2009-02-10 Thread Dinesh B Vadhia
You're probably right Paul.  But, my assumption is that the originators of 
legal documents pay a little more attention to getting the citation correct and 
in the right format then say Joe Bloggs does when completing an address block.  

I think that Kent has reached the end of his commendable effort.  I'll test out 
the latest version in anger over the coming weeks on large numbers of legal 
documents.

Dinesh





Message: 2
Date: Tue, 10 Feb 2009 14:29:20 -0600
From: "Paul McGuire" 
Subject: Re: [Tutor] Picking up citations
To: 
Message-ID: <0a8f5cca89bf4b08becd3c4b86f18...@awa2>
Content-Type: text/plain; charset="us-ascii"

Dinesh and Kent -

I've been lurking along as you run this problem to ground.  The syntax you
are working on looks very slippery, and reminds me of some of the issues I
had writing a generic street address parser with pyparsing
(http://pyparsing.wikispaces.com/file/view/streetAddressParser.py).  Mailing
list companies spend beaucoup $$$ trying to parse addresses in order to
filter duplicates, to group by zip code, street, neighborhood, etc., and
this citation format looks similarly scary.  

Congratulations on getting to a 95% solution using PLY.

-- Paul



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor