Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-24 Thread Mensanator
On Dec 24, 10:18 pm, Benjamin Kaplan  wrote:
> On Thu, Dec 24, 2009 at 9:11 PM, Mensanator  wrote:
> > Ok, so I got a MacBook Air.
>
> > Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed.
>
> > So I install Xcode, download macports and download gmpy-1.11rc1.
>
> > Following the instructions in mac_build.txt, I do the following:
>
> > - sudo /opt/local/bin/port install gmp
>
> > This works fine.
>
> > Then I do
>
> > - python setup.py install
>
> > This also works (a few warnings, but nothing looked serious).
>
> > Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> > [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> > Type "help", "copyright", "credits" or "license" for more information.
>  import gmpy
>  gmpy.version()
> > '1.11'
>
> > python gmpy_test.py
> > Unit tests for gmpy 1.11
> >    on Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> > [GCC 4.2.1 (Apple Inc. build 5646)]
> > Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
> > gmpy_test_cvr 151 tests, 0 failures
> > .
> > .
> > .
> >  25 tests in gmpy_test_rnd.__test__.rand
> > 1469 tests in 42 items.
> > 1469 passed and 0 failed.
> > Test passed.
>
> > Looks like a viable gmpy module for 2.6.
>
> > What do I do AFTER I install Python 3.1? Just running python3.1 from
> > the
> > same directory doesn't work.
>
> > I've spent the last 5 days trying to figure that out. I hosed it so
> > bad
> > I somehow wrecked the 2.6 version to the point where it won't even
> > load.
>
> > I just got done doing a factory restore of the entire OS to undo
> > everything
> > I did. Re-did all the above and got it back working. Haven't re-
> > installed 3.1
> > yet.
>
> > Anbody have any idea how to make this work?
>
> Did you run setup.py with python3? Python 3.1 won't install itself as
> the default python install for compatibility reasons so you have to
> run "python3 install setup.py" to install it for that version of
> python.

I wondered why there was both python3 and python3.1 in the bin
directory.

But why, when I type...

$ python3

...do I get...

Python 3.1.1 (r311:74543, Aug 24 2009, 18:44:04)
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
[1]+  Stopped python3

I get the same result with python3.1.

So, no, trying python3 is of no help, same errors as before.
There's hundreds of them, but they start out

$ /Library/Frameworks/Python.framework/Versions/3.1/bin/python3
setup.py install
running install
running build
running build_ext
building 'gmpy' extension
creating build/temp.macosx-10.3-fat-3.1
creating build/temp.macosx-10.3-fat-3.1/src
Compiling with an SDK that doesn't seem to exist: /Developer/SDKs/
MacOSX10.4u.sdk
Please check your Xcode installation
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -
fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -I./src -I/
opt/local/include -I/Library/Frameworks/Python.framework/Versions/3.1/
include/python3.1 -c src/gmpy.c -o build/temp.macosx-10.3-fat-3.1/src/
gmpy.o
In file included from src/gmpy.c:206:
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:11:20: error: limits.h: No such file or directory
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:14:2: error: #error "Something's broken.  UCHAR_MAX should be
defined in limits.h."
/Library/Frameworks/Python.framework/Versions/3.1/include/python3.1/
Python.h:18:

Any other ideas? Do I have to install a separate Python 3?

>
>
>
> > --
> >http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list


[wxPy] Why I can not change a ListItem property?

2009-12-24 Thread David
I have la ListCtrl in LC_REPORT mode and i need to change the color of a
single cell.
I tried to set the ListItem properties like this

item = wx.ListItem()
item.SetId(currId)
item.SetColumn(currCol)
item.SetText(text)
item.SetTextColour(wx.RED)
mylistctrl.SetItem(item)

but the .SetTextColor doesn't seem to do anything.
How can I change properties of a single cell?
Where can i find more detailed documentation? I read the documentation at 
http://docs.wxwidgets.org/stable/wx_wxlistitem.html#wxlistitem
but I can not figure out how and when I am supposed to use the 'm_mask'
property.

TIA

David.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Testing for empty list

2009-12-24 Thread Benjamin Kaplan
On Thu, Dec 24, 2009 at 11:56 PM, Rodrick Brown  wrote:
 p=[]
 if p is None:
> ...   print 'yes'
> ...

> This doesn't work as expected.

That probably means that what you expect is wrong.
>>>p = []
# p is now a list object at a certain location
>>> if p is None:
#check to see if p (a list object with 0 elements) is the same object
as None (a singleton of the NoneType)
#the answer is no it's not, so it doesn't execute what's in there.

there are several ways to check to see if a list is empty:


if not p :
 The preferred way, but it doesn't always work the way you want. 0,
False, None, and any object with a len() of 0 evaluate to false.

if len(p) == 0 :
checks to see if p is a collection with 0 elements

if p == [] :
probably the obvious choice to beginners, but it isn't pythonic
because it doesn't allow for duck typing


> --
> [ Rodrick R. Brown ]
> http://www.rodrickbrown.com http://www.linkedin.com/in/rodrickbrown
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Testing for empty list

2009-12-24 Thread Rodrick Brown
>>> p=[]
>>> if p is None:
...   print 'yes'
...
>>>

This doesn't work as expected.

-- 
[ Rodrick R. Brown ]
http://www.rodrickbrown.com http://www.linkedin.com/in/rodrickbrown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: sqlite3 .mode option to create HTML table automatically?

2009-12-24 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

davidj411 wrote:
> the CLI for sqlite3 shows .mode of "html", which formats the output in
> HTML format that is good to add to .
> 
> BUT i have not yet found anything for sqlite in python that does this.

The CLI is extra code (in C) that wraps the SQLite library and adds
functionality like this.  You can call the CLI from your Python code (use
the subprocess module) and capture output that way.

Alternatively you can use APSW (disclosure: I am the author of APSW).  APSW
comes with a shell modelled on the SQLite one:

  http://apsw.googlecode.com/svn/publish/shell.html

The Shell is written in Python (see Shell class lower in that page for API
information).  You can instantiate one with stdout set to a StringIO and
then give it commands by calling shell.process_complete_line.

You can also embed the Shell in your program, add commands and output modes etc.

> also, i'd like to know if i can get headers in the result set.
> The CLI uses '.header ON' to enable this.
> is there a place where i can change this too?

The APSW shell supports that.  The APSW home page is at:

  http://code.google.com/p/apsw/

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAks0QkIACgkQmOOfHg372QS9UgCeJh+QEx61AKK2+7XBFZ0hjIOu
FtYAoKJdjlitJuFmix0DGq7hojqKTIpN
=kRhG
-END PGP SIGNATURE-

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-24 Thread Benjamin Kaplan
On Thu, Dec 24, 2009 at 9:11 PM, Mensanator  wrote:
> Ok, so I got a MacBook Air.
>
> Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed.
>
> So I install Xcode, download macports and download gmpy-1.11rc1.
>
> Following the instructions in mac_build.txt, I do the following:
>
> - sudo /opt/local/bin/port install gmp
>
> This works fine.
>
> Then I do
>
> - python setup.py install
>
> This also works (a few warnings, but nothing looked serious).
>
> Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
 import gmpy
 gmpy.version()
> '1.11'
>
> python gmpy_test.py
> Unit tests for gmpy 1.11
>    on Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
> [GCC 4.2.1 (Apple Inc. build 5646)]
> Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
> gmpy_test_cvr 151 tests, 0 failures
> .
> .
> .
>  25 tests in gmpy_test_rnd.__test__.rand
> 1469 tests in 42 items.
> 1469 passed and 0 failed.
> Test passed.
>
> Looks like a viable gmpy module for 2.6.
>
> What do I do AFTER I install Python 3.1? Just running python3.1 from
> the
> same directory doesn't work.
>
> I've spent the last 5 days trying to figure that out. I hosed it so
> bad
> I somehow wrecked the 2.6 version to the point where it won't even
> load.
>
> I just got done doing a factory restore of the entire OS to undo
> everything
> I did. Re-did all the above and got it back working. Haven't re-
> installed 3.1
> yet.
>
> Anbody have any idea how to make this work?

Did you run setup.py with python3? Python 3.1 won't install itself as
the default python install for compatibility reasons so you have to
run "python3 install setup.py" to install it for that version of
python.

> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Mechanize - Click a table row to navigate to detail page

2009-12-24 Thread Brian D
A search form returns a list of records embedded in a table.

The user has to click on a table row to call a Javascript call that
opens up the detail page.

It's the detail page, of course, that really contains the useful
information.

How can I use Mechanize to click a row?

Any ideas?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Which version of MSVC?90.DLL's to distribute with Python 2.6 based Py2exe executables?

2009-12-24 Thread Jonathan Hartley
On Dec 21, 2:56 pm, Ross Ridge  wrote:
> Jonathan Hartley   wrote:
>
> >Many thanks for that, but my issue is that my programs work fine for
> >me on my computer - but then fail on other people's computers. I'd
> >very strongly prefer for my users to not have to install the MSVCR
> >redistributable installer as well as my program - it would be much
> >better if I could bundle everything up into my py2exe package so that
> >it 'just works' on any Windows computer. So I think that means I'm
> >looking for a stand-alone DLL (or several, plus the manifest file, it
> >sounds like) to bundle up with my py2exe.
>
> Microsoft's documentation describes several possible ways you can
> redistribute the Visual C++ runtime:
>
>        http://msdn.microsoft.com/en-us/library/ms235299.aspx
>
> From the sounds of things, if you only have Visual C++ 2008 Express your
> only option may be to use Visual C++ Redistributable Package.
>
>                                 Ross Ridge
>
> --
>  l/  //   Ross Ridge -- The Great HTMU
> [oo][oo]  rri...@csclub.uwaterloo.ca
> -()-/()/  http://www.csclub.uwaterloo.ca/~rridge/
>  db  //  


Hey. So I think I'm finally getting it.

Am I right to infer that if I want to distribute a py2exe'd
application legally, and have half a chance of it working on a non-
developer's machine, then I have to:

a) Ask my users to run the Visual C++ redistributable installer, as
well as download my program. This is really unfortunate, since one of
the major disadvantages of coding something in Python as opposed to as
a web application is the overhead of asking users to download and
execute anything at all. Asking them to do it twice seems problematic.
Most users would regard this as a deal-breaking hurdle, do you think?

or

b) Buy a copy of Visual Studio in order to acquire the rights to
distribute msvcr.dll (etc.) along with my application.

This is kind of a shame, because it rules out the most obvious and
desirable solution, which would be to distribute the DLLs which are
required to give my Python application half a chance of running on my
target user's PC's, without having to buy Visual Studio.

-- 
http://mail.python.org/mailman/listinfo/python-list


How do I install GMPY 1.11 on a Mac with OS X 10.6 and Python 3.1?

2009-12-24 Thread Mensanator
Ok, so I got a MacBook Air.

Has OS X 10.6 (Snow Leopard) and Python 2.6.1 already installed.

So I install Xcode, download macports and download gmpy-1.11rc1.

Following the instructions in mac_build.txt, I do the following:

- sudo /opt/local/bin/port install gmp

This works fine.

Then I do

- python setup.py install

This also works (a few warnings, but nothing looked serious).

Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> gmpy.version()
'1.11'

python gmpy_test.py
Unit tests for gmpy 1.11
on Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[GCC 4.2.1 (Apple Inc. build 5646)]
Testing gmpy 1.11 (GMP 4.3.1), default caching (100, 128)
gmpy_test_cvr 151 tests, 0 failures
.
.
.
  25 tests in gmpy_test_rnd.__test__.rand
1469 tests in 42 items.
1469 passed and 0 failed.
Test passed.

Looks like a viable gmpy module for 2.6.

What do I do AFTER I install Python 3.1? Just running python3.1 from
the
same directory doesn't work.

I've spent the last 5 days trying to figure that out. I hosed it so
bad
I somehow wrecked the 2.6 version to the point where it won't even
load.

I just got done doing a factory restore of the entire OS to undo
everything
I did. Re-did all the above and got it back working. Haven't re-
installed 3.1
yet.

Anbody have any idea how to make this work?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getlist question

2009-12-24 Thread MRAB

Victor Subervi wrote:
On Thu, Dec 24, 2009 at 3:28 PM, MRAB > wrote:


Victor Subervi wrote:

Hi;
I have the following code:

 try:
   trueVal = form.getlist(storeColNames[i])
   colNames.append(storeColNames[i])
   if len(trueVal) > 1:
 trueVal = string.join(trueVal, ',')


Unless you're using a very old version of Python, you should be using
the string method:

 trueVal = ','.join(trueVal)


 values.append(trueVal)
   elif len(trueVal) == 1:
 print storeColNames[i], trueVal, ''
 trueVal = '%s' % trueVal[0]
 values.append(trueVal)
   if len(trueVal) > 0:
 sql = '%s="%s"' % (storeColNames[i], trueVal)
 sqlUpdate.append(sql)
 except:
   raise

This works fine except when storeColNames[i] returns no data.
Now, if I were dealing with getfirst instead of getlist, I could
easily put in a nonsense default data value such as '%$#' and
check for that. But how can I do that or something similar (and
preferably more elegant) with getlist, which takes only the one
name parameter?

You just need to check whether len(trueVal) == 0. Simple.


The problem is that it doesn't see the value at all

trueVal = form.getlist(storeColNames[i])
test = ','.join(trueVal)
if len(test) == 0:
  trueVal == ''
 
It simply doesn't register storeColNames[i] if there is nothing provided 
from the referring page. Here's a test printout:



[snip]
You can see from the above part with breaks that "Availability" isn't 
logged. But it is in the insert statement...without a value, which 
throws an error. The complete code follows:



[snip]
Try working through the code by hand for that value.
--
http://mail.python.org/mailman/listinfo/python-list


Re: python 2.x and running shell command

2009-12-24 Thread Sean DiZazzo
On Dec 24, 5:34 am, tekion  wrote:
> On Dec 23, 5:22 pm, Sean DiZazzo  wrote:
>
>
>
> > On Dec 23, 1:57 pm, tekion  wrote:
>
> > > All,
> > > some of the servers I have run python 2.2, which is a drag because I
> > > can't use subprocess module.  My options that I know of is popen2
> > > module.  However, it seems it does not have io blocking
> > > capabilities.   So every time run a command I have open and close a
> > > file handle.  I have command that requires interactive interaction. I
> > > want to be be able to perform following action:
> > > fout, fin = popen2.open2(cmd) #open up interactive session
> > > fin.write(cmd2);
> > > block (input)
> > > fout.readline()
> > > block output
> > > fin.write(cmd2)
> > > and so on...
>
> > > is this possible with popen2 or do I have to use pexpect for the job?
> > > Thanks.
>
> > I've never done that with subprocess, but maybe this will 
> > help:http://www.lysator.liu.se/~astrand/popen5/
>
> > ~Sean
>
> Sean, popen5 is old name for subprocess.

Right.  Thats why I thought it would help.  You _can_ use the
subprocess module on 2.2.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: getlist question

2009-12-24 Thread Victor Subervi
On Thu, Dec 24, 2009 at 3:28 PM, MRAB  wrote:

> Victor Subervi wrote:
>
>> Hi;
>> I have the following code:
>>
>>  try:
>>trueVal = form.getlist(storeColNames[i])
>>colNames.append(storeColNames[i])
>>if len(trueVal) > 1:
>>  trueVal = string.join(trueVal, ',')
>>
>
> Unless you're using a very old version of Python, you should be using
> the string method:
>
>  trueVal = ','.join(trueVal)
>
>
>   values.append(trueVal)
>>elif len(trueVal) == 1:
>>  print storeColNames[i], trueVal, ''
>>  trueVal = '%s' % trueVal[0]
>>  values.append(trueVal)
>>if len(trueVal) > 0:
>>  sql = '%s="%s"' % (storeColNames[i], trueVal)
>>  sqlUpdate.append(sql)
>>  except:
>>raise
>>
>> This works fine except when storeColNames[i] returns no data. Now, if I
>> were dealing with getfirst instead of getlist, I could easily put in a
>> nonsense default data value such as '%$#' and check for that. But how can I
>> do that or something similar (and preferably more elegant) with getlist,
>> which takes only the one name parameter?
>>
>>  You just need to check whether len(trueVal) == 0. Simple.


The problem is that it doesn't see the value at all

trueVal = form.getlist(storeColNames[i])
test = ','.join(trueVal)
if len(test) == 0:
  trueVal == ''

It simply doesn't register storeColNames[i] if there is nothing provided
from the referring page. Here's a test printout:

SKU ['prodSKU1']
Category ['prodCat1']
Name ['name1']
Title ['title1']
Description ['descr']
Price ['123.45']
SortFactor ['500']
Availability ['1']
OutOfStock ['0']
ShipFlatFee ['10']
ShipPercentPrice ['5']
ShipPercentWeight ['2']
TempPrice ['1']
LastDatePrice ['2000-01-01']
Weight ['2.5']
Metal ['14k gold']
PercentMetal ['25']
insert into products (SKU, Category, Name, Title, Description, Price,
SortFactor, Availability, OutOfStock, ShipFlatFee, ShipPercentPrice,
ShipPercentWeight, Associations, TempPrice, LastDatePrice, Weight, Metal,
PercentMetal) values("prodSKU1", "prodCat1", "name1", "title1", "descr",
"123.45", "500", "1", "0", "10", "5", "2", "1", "2000-01-01", "2.5", "14k
gold", "25"); Insert/update successful!
*This page is going to refresh to the principle page of the shopping cart in
5 seconds.*
*
*
You can see from the above part with breaks that "Availability" isn't
logged. But it is in the insert statement...without a value, which throws an
error. The complete code follows:

TIA,
beno

#! /usr/bin/python

import cgitb; cgitb.enable()
import MySQLdb
import cgi
import string
import sys,os
sys.path.append(os.getcwd())
from login import login
from particulars import addStore

def enterProducts4():
  form = cgi.FieldStorage()
  store = form.getfirst('store')
  print '''Content-Type: text/html\r\n



'''
#  print '' % store
  print '\n'
  user, passwd, db, host = login()
  db = MySQLdb.connect(host, user, passwd, db)
  cursor= db.cursor()
  both = ''
  count = 0
  cursor.execute('describe %s;' % store)
  temp = cursor.fetchall()
  tmp = [itm[0] for itm in cursor]
  storeColNames = []
  for descrip in tmp:
storeColNames.append(descrip)
  colNames = []
  colNamesOther = []
  sqlUpdate = []
  sqlUpdatePics = []
  i = 0
  values = []
  valuesPics = []
  pics = []
  colNamesPics = []
  y = 0
  whatDo = form.getfirst('whatDo')
  sql = 'select last_insert_id() from %s;' % store
  cursor.execute(sql)
  try:
id = cursor.fetchone()[0]
  except:
id = 0 # This is obviously the first insert; since insert, will be
incremented below
  if whatDo == 'insert':
id += 1
  i = 0
  while i < len(storeColNames):
if (len(storeColNames[i]) > 3) and (storeColNames[i][:3] == 'pic'):
  y += 1
  pic = form.getfirst(storeColNames[i][:4], '')
  if len(pic) > 0:
pics.append(pic)
  else:
try:
  sql = 'select %s from %s where ID=%s;' % (storeColNames[i][:4],
store, id)
  cursor.execute(sql)
  try:
pic = cursor.fetchone()[0].tostring()
pics.append(pic)
  except:
pass
except: # This means it's an insert, not an update
  pass
  colNamesPics.append(storeColNames[i])
  sqlUpdatePics.append(storeColNames[i] + '="' + trueVal + '"')
else:
  try:
trueVal = form.getlist(storeColNames[i])
test = ','.join(trueVal)
if len(test) == 0:
  trueVal == ''
colNames.append(storeColNames[i])
if len(trueVal) > 1:
  trueVal = string.join(trueVal, ',')
  values.append(trueVal)
elif len(trueVal) == 1:
  print storeColNames[i], trueVal, ''
  trueVal = '%s' % trueVal[0]
  values.append(trueVal)
if len(trueVal) > 0:
  sql = '%s="%s"' % (storeColNames[i], trueVal)
  sqlUpdate.append(sql)
  except:
raise
i += 1
  colNames = string.join(colNames[1:], ', ') # We don't want to include the
ID f

Re: getlist question

2009-12-24 Thread MRAB

Victor Subervi wrote:

Hi;
I have the following code:

  try:
trueVal = form.getlist(storeColNames[i])
colNames.append(storeColNames[i])
if len(trueVal) > 1:
  trueVal = string.join(trueVal, ',')


Unless you're using a very old version of Python, you should be using
the string method:

  trueVal = ','.join(trueVal)


  values.append(trueVal)
elif len(trueVal) == 1:
  print storeColNames[i], trueVal, ''
  trueVal = '%s' % trueVal[0]
  values.append(trueVal)
if len(trueVal) > 0:
  sql = '%s="%s"' % (storeColNames[i], trueVal)
  sqlUpdate.append(sql)
  except:
raise

This works fine except when storeColNames[i] returns no data. Now, if I 
were dealing with getfirst instead of getlist, I could easily put in a 
nonsense default data value such as '%$#' and check for that. But how 
can I do that or something similar (and preferably more elegant) with 
getlist, which takes only the one name parameter?



You just need to check whether len(trueVal) == 0. Simple.
--
http://mail.python.org/mailman/listinfo/python-list


Re: getlist question

2009-12-24 Thread Emile van Sebille

On 12/24/2009 12:05 PM Victor Subervi said...

Hi;
I have the following code:

   try:
 trueVal = form.getlist(storeColNames[i])
 colNames.append(storeColNames[i])
 if len(trueVal) > 1:
   trueVal = string.join(trueVal, ',')
   values.append(trueVal)
 elif len(trueVal) == 1:
   print storeColNames[i], trueVal, ''
   trueVal = '%s' % trueVal[0]
   values.append(trueVal)
 if len(trueVal) > 0:
   sql = '%s="%s"' % (storeColNames[i], trueVal)
   sqlUpdate.append(sql)
   except:
 raise

This works fine except when storeColNames[i] returns no data. Now, if I
were dealing with getfirst instead of getlist, I could easily put in a
nonsense default data value such as '%$#' and check for that. But how
can I do that or something similar (and preferably more elegant) with
getlist, which takes only the one name parameter?
TIA,
beno



trueVal = form.getlist(storeColNames[i]) or  '%$#'

Assuming of course that 'returns no data' evaluates as false.

Emile

--
http://mail.python.org/mailman/listinfo/python-list


getlist question

2009-12-24 Thread Victor Subervi
Hi;
I have the following code:

  try:
trueVal = form.getlist(storeColNames[i])
colNames.append(storeColNames[i])
if len(trueVal) > 1:
  trueVal = string.join(trueVal, ',')
  values.append(trueVal)
elif len(trueVal) == 1:
  print storeColNames[i], trueVal, ''
  trueVal = '%s' % trueVal[0]
  values.append(trueVal)
if len(trueVal) > 0:
  sql = '%s="%s"' % (storeColNames[i], trueVal)
  sqlUpdate.append(sql)
  except:
raise

This works fine except when storeColNames[i] returns no data. Now, if I were
dealing with getfirst instead of getlist, I could easily put in a nonsense
default data value such as '%$#' and check for that. But how can I do that
or something similar (and preferably more elegant) with getlist, which takes
only the one name parameter?
TIA,
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Mechanize/ClientForm - How to select IgnoreControl button and submit form

2009-12-24 Thread Brian D
On Dec 23, 8:33 am, Brian D  wrote:
> All,
>
> I'm hoping to implement a project that will be historically
> transformational by mapping inequalities in property assessments.
>
> I'm stuck at step one: Scrape data fromhttp://www.opboa.org.
>
> The site uses a bunch of hidden controls. I can't find a way to get
> past the initial disclaimer page because the "Accept" button value
> reads as None: )>
>
> http://www.opboa.org/Search/Disclaimer2.aspx
>
> I've successfully used Mechanize in two other projects, but I've never
> seen this IgnoreControl problem before. I also haven't found any
> ClientForm examples that handle this problem.
>
> Would anyone like to help me get this off the ground?
>
> Thanks!

Solution posted in another thread:

http://groups.google.com/group/comp.lang.python/browse_thread/thread/2013c8dcbe6a8573/a39c33475b2d2923#a39c33475b2d2923
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: ORM's are evil. Was: Mechanize/ClientForm - How to select IgnoreControl button and submit form

2009-12-24 Thread Brian D
On Dec 24, 8:20 am, Brian D  wrote:
> Just kidding. That was a fascinating discussion.
>
> Now I'd like to see if anyone would rather procrastinate than finish
> last-minute shopping.
>
> This problem remains untouched. Anyone want to give it a try? Please?
>
> I'm hoping to implement a project that will be historically
> transformational by mapping inequalities in property assessments.
>
> I'm stuck at step one: Scrape data fromhttp://www.opboa.org.
>
> The site uses a bunch of hidden controls.
>
> I can't find a way to get past the initial disclaimer page because the
> "Accept" button value reads as None: 
> )>http://www.opboa.org/Search/Disclaimer2.aspx
>
> I've successfully used Mechanize in two other projects, but I've never
> seen this IgnoreControl problem before. I also haven't found any
> ClientForm examples that handle this problem.
>
> Would anyone like to help me get this off the ground?
>
> Thanks!

Problem solved.

I used the Fiddler Request Builder to discover that the server wanted
a GET request containing the ASP.NET __EVENTTARGET, __EVENTARGUMENT,
and __VIEWSTATE parameters.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Broadband TV

2009-12-24 Thread Victor Subervi
On Thu, Dec 24, 2009 at 2:13 PM, MRAB  wrote:

> Victor Subervi wrote:
>
>> My professional background before programming was media and I got into
>> this because I saw where the industry was eventually headed. I'd like to
>> find out what the people in the know have to say about when broadband
>> quality is high enough to reliably stream video and the penetration of such
>> broadband is high enough to topple the local media outlets. I haven't had
>> success googling this, nor have I found a discussion list that would address
>> such a question. Any ideas?
>>
>>  There's already BBC iPlayer and other catch-up services in the UK. HDTV
> is/will be available where broadband speeds are fast enough.
>

I presume, then, that you either live in the UK or are very acquainted with
it. As you probably are aware, the rest of the world is about 3 years ahead
of the US because of our archaic communications infrastructure that cripples
competition. So you say it's already started in the UK. Any ideas when
broadband speeds will be fast enough on the other side of the pond?
TIA,
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT: Broadband TV

2009-12-24 Thread MRAB

Victor Subervi wrote:
My professional background before programming was media and I got into 
this because I saw where the industry was eventually headed. I'd like to 
find out what the people in the know have to say about when broadband 
quality is high enough to reliably stream video and the penetration of 
such broadband is high enough to topple the local media outlets. I 
haven't had success googling this, nor have I found a discussion list 
that would address such a question. Any ideas?



There's already BBC iPlayer and other catch-up services in the UK. HDTV
is/will be available where broadband speeds are fast enough.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Apple Mac OS X 10.6 support & compatability with Python 3 ?

2009-12-24 Thread Jonas Geiregat
I'm using Python 3 on my Mac running Snow Leopard. I run it alongside the 
standard python that comes with leopard wich is 2.6 , if I remember correctely.
This setup hasn't given me any trouble so far !
I've downloaded the binary version of Python3000 from the python.org website.

Good luck with it ! 

Op 16-dec-2009, om 18:41 heeft pdlem...@earthlink.net het volgende geschreven:

> I've been given a MAC AIR laptop with OS X 10.6 "Snow Leopard". 
> On my desktop I dual boot with XP - Ubuntu and have Python on both.
> Unfortunately all my Python programs are written on Windows XP and
> I heavily rely on WConio for console I/O.
> Called Apple tech support. The technician had never heard of Python,
> ascertained the MAC AIR does not come preloaded with Python and 
> did not know if Python 3 would run under OS X 10.6. This was "beyond"
> their expertise.
> Does anyone have experience with OS X ? Could I use WConio in a 
> Windows emulator ?  I have no experience with MACs and am debating
> whether to send this back before opening.  
> Thanks. Dave WB3DWE
> -- 
> http://mail.python.org/mailman/listinfo/python-list

Met vriendelijke groeten,

Jonas Geiregat
jo...@geiregat.org




-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Threading with queues

2009-12-24 Thread Lie Ryan

On 12/24/2009 2:11 PM, Gib Bogle wrote:

Lie Ryan wrote:

On 12/22/2009 10:47 AM, Gib Bogle wrote:

It turns out that this code isn't a great demo of the advantages of
threading, on my system anyway. The time taken to execute doesn't vary
much when the number of threads is set anywhere from 1 to 6.


it does in mine:

Elapsed Time: 7.4737711 (with one thread)
Elapsed Time: 1.9015041 (with five threads)

what sort of weird machine are you in?


Hmmm, interesting. I am running Windows XP on Intel quad core hardware,
Q6600. And you?


On [AMD64 X2 K8 Turion 1.6 Ghz] on Vista (32-bit)
--
http://mail.python.org/mailman/listinfo/python-list


Re: Join a thread and get the return value of a function

2009-12-24 Thread Lie Ryan

On 12/25/2009 2:02 AM, mattia wrote:

Il Fri, 25 Dec 2009 00:35:55 +1100, Lie Ryan ha scritto:


On 12/25/2009 12:23 AM, mattia wrote:

Hi all, is there a way in python to get back the value of the function
passed to a thread once the thread is finished? Something like
pthread_join() in C?

Thanks, Mattia


use a Queue to pass the value out?


Yes, it can be a solution, but are you indirectly telling me that there
is no way then?


looking at the threading.py source code, it is clear that the return 
value of Thread.run() is ignored, but this is a workaround:


import threading

class MyThread(threading.Thread):
def join(self):
super(MyThread, self).join()
return self.result

class Worker(MyThread):
def run(self):
total = 0
for i in range(random.randrange(1, 10)):
total += i
self.result = total

import random
ts = [Worker() for i in range(100)]
for t in ts:
t.start()

for t in ts:
print t.join()
--
http://mail.python.org/mailman/listinfo/python-list


OT: Broadband TV

2009-12-24 Thread Victor Subervi
Hi;
My professional background before programming was media and I got into this
because I saw where the industry was eventually headed. I'd like to find out
what the people in the know have to say about when broadband quality is high
enough to reliably stream video and the penetration of such broadband is
high enough to topple the local media outlets. I haven't had success
googling this, nor have I found a discussion list that would address such a
question. Any ideas?
TIA,
beno
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to tailor output of help()

2009-12-24 Thread Steve Holden
Kyle wrote:
> Hi all,
> I'm a graduate student in the physical sciences and still new to
> Python. I'm writing a module of often-used code and have included
> several math functions in my module via
> 
> from math import cos
> 
> and similarly for other functions. When I input help(mymodule) into
> the console, cos() and its docstring are listed in the output section
> for my module's functions. However, I only want functions that I have
> written to appear, not those that I imported. I know this is merely
> aesthetic, but is there a way to eliminate functions that I imported
> from the function list in the output from help()? Thanks,
> 
Try setting the __all__ variable in your module to a list of the names
you want your module to export.

regards
 Steve

-- 
Steve Holden   +1 571 484 6266   +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010  http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS:http://holdenweb.eventbrite.com/

-- 
http://mail.python.org/mailman/listinfo/python-list


How to tailor output of help()

2009-12-24 Thread Kyle
Hi all,
I'm a graduate student in the physical sciences and still new to
Python. I'm writing a module of often-used code and have included
several math functions in my module via

from math import cos

and similarly for other functions. When I input help(mymodule) into
the console, cos() and its docstring are listed in the output section
for my module's functions. However, I only want functions that I have
written to appear, not those that I imported. I know this is merely
aesthetic, but is there a way to eliminate functions that I imported
from the function list in the output from help()? Thanks,

-kmd
-- 
http://mail.python.org/mailman/listinfo/python-list


Attributions (was Re: switch)

2009-12-24 Thread Aahz
In article ,
Tim Chase   wrote:
>On 12/10/2009 09:22 PM, John Bokma wrote:
>>
>> Please don't delete attribution line(s), added:
>>
>> Asun Friere writes:
>
>I tend to prune them because a good newsreader will thread messages
>and put my reply in the context of the message to which I'm replying.  

You are assuming that everyone will get all messages.  Even in this day
of better network connections, that is an ill-founded assumption.
Moreover, you have no assurance that the message will be read in the
context of a newsgroup; consider someone forwarding a single message.

Always always always provide attributions for quoting, it's just the
Right Thing.
-- 
Aahz (a...@pythoncraft.com)   <*> http://www.pythoncraft.com/

Looking back over the years, after I learned Python I realized that I
never really had enjoyed programming before.
-- 
http://mail.python.org/mailman/listinfo/python-list


python 2.x and running shell command

2009-12-24 Thread Boris Arloff
>On Dec 23, 5:22 pm, Sean DiZazzo  wrote:
> On Dec 23, 1:57 pm, tekion  wrote:
>
>
>
> > All,
> > some of the servers I have run python 2.2, which is a drag because I
> > can't use subprocess module.  My options that I know of is popen2
> > module.  However, it seems it does not have io blocking
> > capabilities.   So every time run a command I have open and close a
> > file handle.  I have command that requires interactive interaction. I
> > want to be be able to perform following action:
> > fout, fin = popen2.open2(cmd) #open up interactive session
> > fin.write(cmd2);
> > block (input)
> > fout.readline()
> > block output
> > fin.write(cmd2)
> > and so on...
>
> > is this possible with popen2 or do I have to use pexpect for the job?
> > Thanks.
>
> I've never done that with subprocess, but maybe this will 
> help:http://www.lysator.liu.se/~astrand/popen5/
>
> ~Sean
>Sean, popen5 is old name for subprocess.
 
If using a linux platform then look into setting up pipes.  This will give you 
a communications channel and you can interact with your processes.  I have used 
this method many times.
 


  -- 
http://mail.python.org/mailman/listinfo/python-list


PYO versus PYC Behavior

2009-12-24 Thread Boris Arloff
All python docs and description indicate that optimization (-OO) does not do 
much anything except the removal off pydoc. A single "O" removes comments and 
asserts, and with the removal of pydoc with double "O" option the *.pyo byte 
compile is left with pure executable code.  I am experiencing a different 
behavior than described.
 
I am running Python 2.6.4 and have source code which I pre-compile either into 
pyc or pyo files depending on the optimization switch selected.  The pyo 
version fails to run with the main program module failing to import any other 
modules, such as failing on the "import os" statement (first line 
encountered).  However, the pyc version succeeds and runs correctly.  This is 
with the same code modules, same python VM and same machine.
 
One item I should note is that the Python distribution I am using is not fully 
installed with paths set by the installer.  I unpack the Python tar and compile 
it (i.e. ran configure and make; not make install).  Then I distribute the this 
Python VM, with its Lib and Modules dirs into my target machine (a Linux 
distro) and collocate my pyc or pyo modules at the root with python.
 
To further experiment, I have also compiled all python libraries to either pyc 
and pyo (e.g. os.pyc or os.pyo in the Modules dir).  If I then run with 
interactive python, I experience the same effect as executing from command 
line.  Under the IDE "import os" fails if I distribute with python modules 
compiled into pyo, but it succeeds if I distribute pyc modules.
 
This seems to be contrary to the documentation.  If the only difference was the 
removal of pydoc between pyc and pyo then both versions should behave exactly 
the same way.  There must be some additional modifications with a -OO compile.
 
Anyone can comment, please?
 
Thanks,
Boris
 
 


  -- 
http://mail.python.org/mailman/listinfo/python-list


Re: Join a thread and get the return value of a function

2009-12-24 Thread mattia
Il Fri, 25 Dec 2009 00:35:55 +1100, Lie Ryan ha scritto:

> On 12/25/2009 12:23 AM, mattia wrote:
>> Hi all, is there a way in python to get back the value of the function
>> passed to a thread once the thread is finished? Something like
>> pthread_join() in C?
>>
>> Thanks, Mattia
> 
> use a Queue to pass the value out?

Yes, it can be a solution, but are you indirectly telling me that there 
is no way then?
-- 
http://mail.python.org/mailman/listinfo/python-list


ORM's are evil. Was: Mechanize/ClientForm - How to select IgnoreControl button and submit form

2009-12-24 Thread Brian D
Just kidding. That was a fascinating discussion.

Now I'd like to see if anyone would rather procrastinate than finish
last-minute shopping.

This problem remains untouched. Anyone want to give it a try? Please?

I'm hoping to implement a project that will be historically
transformational by mapping inequalities in property assessments.

I'm stuck at step one: Scrape data from http://www.opboa.org.

The site uses a bunch of hidden controls.

I can't find a way to get past the initial disclaimer page because the
"Accept" button value reads as None: )>
http://www.opboa.org/Search/Disclaimer2.aspx

I've successfully used Mechanize in two other projects, but I've never
seen this IgnoreControl problem before. I also haven't found any
ClientForm examples that handle this problem.

Would anyone like to help me get this off the ground?

Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Doesn't MS-Windows likes Python ? (or: why more than 20 sec delaywhen running a program from Python)

2009-12-24 Thread Jim Carlock
"Stef Mientki" wrote...
:
: I've an AutoIt program that set some switches in the LAN settings.
: 
: When I launch the AutoIt executable, the settings are changed
: immediately.
: 
: When I launch the AutoIt executable from python (which is the
: intention), it hangs for about 20 seconds, before any action
: appears on the screen.
: 
: Analyzing the script, shows that it hangs on the next 2 lines:
: 
:   Run ( "control.exe ncpa.cpl" )
:   WinWait( "Network Connections")
: 
: Transfering the Run command to Python, it hangs on the next
: subprocess call
:  subprocess.call ( [ r"control.exe",  "ncpa.cpl" ])
: 
: Does anyone have a clue, why starting a process takes 20 seconds
: longer when ran from Python ?
: 
: And even more important, is there a work around ?

I know this is almost two months late.

Control.exe is the program which starts up the control panel. The
easiest thing to try is to use a fully qualified path to start it.

"%systemroot%\system32\control.exe" ncpa.cpl

The above should help with W95 to Windows XP. For 64-bit versions
control.exe might reside in a system64 folder.

Did you ever figure out the solution to the problem?

-- 
Jim Carlock

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with Dynamically unloading a module

2009-12-24 Thread Lie Ryan

On 12/24/2009 11:51 PM, Jean-Michel Pichavant wrote:

But what he *can* do is to learn how importing works. I'm not sure
it's terribly helpful to tell somebody all the things they can't do
instead of what they can.



Hacking python imports would not be in the top of the list of things I
would teach to some python newcomer, that was my point.

And to be a little more constructive, let's give the OP a litle bit of
help.

How can you unload module in python ?

That I don't know, anyone knows ?


Given that there is no way to ensure deconstruction of an object 
instance (`del` only removes the reference and __del__ can only remove 
the resources used by the instance but not the instance itself), why 
would anyone expect it is possible to unload a module explicitly (which 
is a deconstruction of the module)

--
http://mail.python.org/mailman/listinfo/python-list


Re: Join a thread and get the return value of a function

2009-12-24 Thread Lie Ryan

On 12/25/2009 12:23 AM, mattia wrote:

Hi all, is there a way in python to get back the value of the function
passed to a thread once the thread is finished? Something like
pthread_join() in C?

Thanks, Mattia


use a Queue to pass the value out?
--
http://mail.python.org/mailman/listinfo/python-list


Re: python 2.x and running shell command

2009-12-24 Thread tekion
On Dec 23, 5:22 pm, Sean DiZazzo  wrote:
> On Dec 23, 1:57 pm, tekion  wrote:
>
>
>
> > All,
> > some of the servers I have run python 2.2, which is a drag because I
> > can't use subprocess module.  My options that I know of is popen2
> > module.  However, it seems it does not have io blocking
> > capabilities.   So every time run a command I have open and close a
> > file handle.  I have command that requires interactive interaction. I
> > want to be be able to perform following action:
> > fout, fin = popen2.open2(cmd) #open up interactive session
> > fin.write(cmd2);
> > block (input)
> > fout.readline()
> > block output
> > fin.write(cmd2)
> > and so on...
>
> > is this possible with popen2 or do I have to use pexpect for the job?
> > Thanks.
>
> I've never done that with subprocess, but maybe this will 
> help:http://www.lysator.liu.se/~astrand/popen5/
>
> ~Sean

Sean, popen5 is old name for subprocess.
-- 
http://mail.python.org/mailman/listinfo/python-list


Join a thread and get the return value of a function

2009-12-24 Thread mattia
Hi all, is there a way in python to get back the value of the function 
passed to a thread once the thread is finished? Something like 
pthread_join() in C?

Thanks, Mattia
-- 
http://mail.python.org/mailman/listinfo/python-list


Extra fields for logging

2009-12-24 Thread Joan Miller
I'm trying to add some extra fields to logging, I'm following this
information [1] but it faills in my case.

# module logger.py

import logging

class ExtraInfo(object):
def __getitem__(self, name):
if name == 'host':
result = 'foo'
def __iter__(self):
keys = ['host',]
keys.extend(self.__dict__.keys())
return keys.__iter__()

def setup(filename='/tmp/foo.log'):
log = logging.LoggerAdapter(logging.getLogger('foo'), ExtraInfo())
#log = logging.LoggerAdapter(logging.getLogger('foo'), {'host':
'bar'})

logging.basicConfig(
level=logging.DEBUG,
format=(
"Date-Time: %(asctime)s\n"
"Host: %(host)s\n"
"%(levelname)s:\n"
"%(message)s"),
# %f => microseconds is not showed, bug?
datefmt="%Y-%m-%dT%H:%M:%S%z",
filename=filename,
filemode='w')


# module another.py

import logger

logger.setup()
logging.getLogger('foo')
logging.error('testing ...')


I get => KeyError: 'host'


---
System: Ubuntu 9.10 - Python 2.6.4
---

[1] 
http://docs.python.org/library/logging.html#adding-contextual-information-to-your-logging-output
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Problem with Dynamically unloading a module

2009-12-24 Thread Jean-Michel Pichavant

Steven D'Aprano wrote:

On Wed, 23 Dec 2009 15:31:53 +0100, Jean-Michel Pichavant wrote:

  

Steven D'Aprano wrote:


On Wed, 23 Dec 2009 13:37:06 +0100, Jean-Michel Pichavant wrote:


  

But believe me, you don't want to mess up with the python import
mechanism.




Unless you understand how it works.



  

Let me quote the OP: 'Not an expert in Python' I was just answering the
OP question, without refering to something he could do if he was someone
else.



But what he *can* do is to learn how importing works. I'm not sure it's 
terribly helpful to tell somebody all the things they can't do instead of 
what they can.



  
Hacking python imports would not be in the top of the list of things I 
would teach to some python newcomer, that was my point.


And to be a little more constructive, let's give the OP a litle bit of help.

How can you unload module in python ?

That I don't know, anyone knows ?

JM
--
http://mail.python.org/mailman/listinfo/python-list


Re: Regex help needed!

2009-12-24 Thread F.R.



On 21.12.2009 12:38, Oltmans wrote:

Hello,. everyone.

I've a string that looks something like

lksjdfls  kdjff lsdfs  sdjflssdfsdwelcome


> From above string I need the digits within the ID attribute. For
example, required output from above string is
- 35343433
- 345343
- 8898

I've written this regex that's kind of working
re.findall("\w+\s*\W+amazon_(\d+)",str)

but I was just wondering that there might be a better RegEx to do that
same thing. Can you kindly suggest a better/improved Regex. Thank you
in advance.
   


If you filter in two or even more sequential steps the problem becomes a 
lot simpler, not least because you can

test each step separately:

>>> r1 = re.compile (']*')   # Add ignore case and 
variable white space

>>> r2 = re.compile ('\d+')
>>> [r2.search (item).group () for item in r1.findall (s) if item] 
# s is your sample

['345343', '35343433', '8898'] # Supposing all ids have digits

Frederic

--
http://mail.python.org/mailman/listinfo/python-list


Re: how to register with pypi - no such setup.py

2009-12-24 Thread Martin v. Loewis
> Any tips?

A binary distribution won't have a setup.py, because
you can install it by other means (such as Windows Installer),
instead of running setup.py

What you want is a source distribution (sdist).

Even if you want to create a binary distribution, don't use the
bdist command, but some specialization, such as bdist_rpm.

Regards,
Martin
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Object Relational Mappers are evil (a meditation)

2009-12-24 Thread Lie Ryan

On 12/24/2009 12:11 PM, Terry Reedy wrote:

This buggy idiom survived many years of Python development, missed by
virtually everyone.


The last statement is false. The hazard of using and/or was well-known
back in '97 or so when I discovered or learned it and I believe it was
mentioned in the FAQ entry on the subject. The new alternative has the
hazard that the condition and if-branch must be written and read in a
backwards order. I consider that buggy and do not use it for that reason.


Oh really? I thought putting the conditional in the middle was 
ingenious, whoever thought that must have the next Turing award!


I always feel there's something wrong with the (condition ? true : 
false) or (if condition then true else false) expressions found in other 
languages; and just realized it was because of their unnatural ordering. 
I have to admit initially the reversed ordering do confound me, but 
afterward it felt even more natural than the traditional 
"conditional-first" expression.

--
http://mail.python.org/mailman/listinfo/python-list


Re: wave robot notes

2009-12-24 Thread Duncan Booth
Aaron Watters  wrote:

> I implemented a Google Wave Robot which annotates
> BNF syntax rules using railroad diagram images.
> I put notes about the implementation process
> here for the benefit of posterity.
> 
> http://listtree.appspot.com/firstWaveRobot
> 
> The robot Id is
> 
> whiff-gae-tutor...@appspot.com
> 
> -- if you are using wave, please add it to a wave and try it out.
> It should "respond" to a BNF rule you type in like this one:
> 
> program ::= "begin" (statement ";")+ "end" $$
> 
> Happy Holidays everyone... I'm off to the slopes :).
>-- Aaron Watters

Nice one.

Smooth curves would be nicer than angles if your graphics are up to it.

If you repeat an expression that already exists further up the Wave it 
looks like the robot ignores the duplicate. Is that deliberate?

This one looks nice if you want a reasonably complex example.

import_stmt ::= "import" module ["as" name]( "," module ["as" name] )*| 
"from" relative_module "import" identifier["as" name]( "," identifier 
["as"name] )*| "from" relative_module "import" "("identifier ["as" name]( 
","identifier ["as" name] )* [","] ")"| "from" module "import" "*"  

It would be really great if the diagram was interactive: I don't know if 
Wave's api lets you define anchors and jumps to anchors, but if it does 
then you could make non-terminals clickable.

P.S. could you use a standard signature separator please so I don't have to 
trim your signature off the reply by hand?
-- 
http://mail.python.org/mailman/listinfo/python-list